Exemplo n.º 1
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            //OYM:更新表现形式;

            if (!Application.isPlaying)
            {
                EditorGUILayout.PropertyField(serializedObject.FindProperty("settings"), new GUIContent("全局关联设置"), true);

                Titlebar("=============== 节点设置", new Color(0.7f, 1.0f, 0.7f));
                controller.generateTransform = (Transform)EditorGUILayout.ObjectField(new GUIContent("搜索起始点"), controller.generateTransform, typeof(Transform), true);
                EditorGUILayout.PropertyField(serializedObject.FindProperty("generateKeyWordWhiteList"), new GUIContent("识别关键词"), true);
                EditorGUILayout.PropertyField(serializedObject.FindProperty("blackListOfGenerateTransform"), new GUIContent("节点黑名单"), true);
                EditorGUILayout.PropertyField(serializedObject.FindProperty("generateKeyWordBlackList"), new GUIContent("关键词黑名单"), true);

                if (GUILayout.Button("生成节点数据", GUILayout.Height(22.0f)))
                {
                    controller.ListCheck();
                    controller.InitializePoint();
                    controller.isDebug = true;
                }

                if (controller.allPointTrans != null)
                {
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("inspectorPointList"), new GUIContent("所有节点坐标 :" + controller.allPointTrans?.Count), true);
                    GUILayout.Space(5);
                }

                Titlebar("=============== 碰撞体设置", new Color(0.7f, 1.0f, 0.7f));
                string key = controller.isGenerateColliderAutomaitc ? "生成" : "刷新";

                if (GUILayout.Button(key + "碰撞体", GUILayout.Height(22.0f)))
                {
                    controller.initializeCollider();
                    controller.isDebug = true;
                }
                controller.isGenerateColliderAutomaitc = EditorGUILayout.Toggle("自动生成全身碰撞体 ", controller.isGenerateColliderAutomaitc);
                if (controller.isGenerateColliderAutomaitc)
                {
                    controller.isGenerateByAllPoint = EditorGUILayout.Toggle("  ┗━以所有节点作为参照 ", controller.isGenerateByAllPoint);
                }
                if (controller.isGenerateColliderAutomaitc)
                {
                    controller.isGenerateFinger = EditorGUILayout.Toggle("  ┗━生成手指 ", controller.isGenerateFinger);
                }



                if (controller.editorColliderList != null)
                {
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("editorColliderList"), new GUIContent("碰撞体列表 :" + controller.editorColliderList?.Count), true);
                    GUILayout.Space(5);
                    if (controller.editorColliderList.Count > 0)
                    {
                        if (GUILayout.Button("移除所有碰撞体", GUILayout.Height(22.0f)))
                        {
                            if (controller.editorColliderList == null)
                            {
                                return;
                            }
                            if (isDeleteCollider)
                            {
                                for (int i = 0; i < controller.editorColliderList.Count; i++)
                                {
                                    DestroyImmediate(controller.editorColliderList[i]);
                                }
                                isDeleteCollider = false;
                            }
                            controller.editorColliderList = null;
                        }
                        isDeleteCollider = EditorGUILayout.Toggle("同时删去碰撞体脚本", isDeleteCollider);
                    }
                }


                Titlebar("=============== physical setting", new Color(0.7f, 1.0f, 0.7f));
                controller.bufferTime = EditorGUILayout.FloatField("延迟时间", controller.bufferTime);
            }
            else
            {
                Titlebar("运行中", new Color(0.5F, 1, 1));
                EditorGUILayout.PropertyField(serializedObject.FindProperty("settings"), new GUIContent("全局关联设置"), true);
                GUILayout.Space(10);

                Titlebar("=============== 节点设置", new Color(0.5F, 1, 1));

                if (GUILayout.Button("重置所有节点位置", GUILayout.Height(22.0f)))
                {
                    controller.RestorePoint();
                }
                if (GUILayout.Button("重置所有节点数据并重新运行", GUILayout.Height(22.0f)))
                {
                    controller.Reset();
                }
                if (controller.allPointTrans != null)
                {
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("inspectorPointList"), new GUIContent("所有节点坐标 :" + controller.allPointTrans?.Count), true);
                }

                Titlebar("===============碰撞体设定", new Color(0.5F, 1, 1));
                GUILayout.Space(5);
                if (GUILayout.Button("重新绘制碰撞体", GUILayout.Height(22.0f)))
                {
                    for (int i = 0; i < controller.editorColliderList.Count; i++)
                    {
                        controller.editorColliderList[i].Refresh();
                    }
                    controller.isDebug = true;
                }

                if (controller.editorColliderList != null)
                {
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("editorColliderList"), new GUIContent("碰撞体列表 :" + controller.editorColliderList?.Count), true);
                }
                Titlebar("=============== physical setting", new Color(0.5F, 1, 1));
            }


            controller.isDebug        = EditorGUILayout.Toggle("是否绘制所有辅助线", controller.isDebug);
            controller.isOptimize     = EditorGUILayout.Toggle("轨迹优化", controller.isOptimize);
            controller.isFuzzyCompute = EditorGUILayout.Toggle("高性能模式", controller.isFuzzyCompute);
            controller.iteration      = EditorGUILayout.IntSlider("迭代次数", controller.iteration, 1, max * (controller.isFuzzyCompute?8:8) * (controller.isDebug?2:1));
            if (controller.iteration > 256)
            {
                controller.isDetectAsync = EditorGUILayout.Toggle("自动优化迭代次数", controller.isDetectAsync);
            }
            controller.windForceScale        = EditorGUILayout.Slider("风力", controller.windForceScale, 0, 1);
            controller.colliderCollisionType = (ColliderCollisionType)EditorGUILayout.EnumPopup("碰撞模式", (ColliderCollisionTypeZh)controller.colliderCollisionType);

            if (controller.colliderCollisionType == 0)
            {
                controller.colliderCollisionType = ColliderCollisionType.Constraint;
            }
            serializedObject.ApplyModifiedProperties();
        }
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            //OYM:更新表现形式;
            GUILayout.Space(8);
            EditorGUILayout.TextField("Name", controller.transform.name);
            if (!Application.isPlaying)
            {
                Titlebar("EditorMode", new Color(0.7f, 1.0f, 0.7f));
            }
            else
            {
                Titlebar("RuntimeMode", Color.red);
            }
            EditorGUILayout.LabelField("=============== Point");
            controller.generateTransform = (Transform)EditorGUILayout.ObjectField(new GUIContent("parent Transform"), controller.generateTransform, typeof(Transform), true);
            EditorGUILayout.PropertyField(serializedObject.FindProperty("generateKeyWordWhiteList"), new GUIContent("Name KeyWord"), true);
            EditorGUILayout.PropertyField(serializedObject.FindProperty("blackListOfGenerateTransform"), new GUIContent("Transform BlackList"), true);
            EditorGUILayout.PropertyField(serializedObject.FindProperty("generateKeyWordBlackList"), new GUIContent("Name Key Word BlackList"), true);

            if (GUILayout.Button("Generate Point", GUILayout.Height(22.0f)))
            {
                controller.initializePoint();
                controller.isDebug = true;
            }

            if (controller.allPointTrans != null)
            {
                EditorGUILayout.PropertyField(serializedObject.FindProperty("allPointTrans"), new GUIContent("All point list"), true);
                GUILayout.Space(5);
            }
            EditorGUILayout.LabelField("=============== Collider");
            if (GUILayout.Button("Generate Collider", GUILayout.Height(22.0f)))
            {
                controller.initializeCollider(true, controller.isGenerateByFixedPoint);
                controller.isDebug = true;
            }
            if (GUILayout.Button("Remove All Collider", GUILayout.Height(22.0f)))
            {
                if (controller.editorColliderList == null)
                {
                    return;
                }
                for (int i = 0; i < controller.editorColliderList.Count; i++)
                {
                    DestroyImmediate(controller.editorColliderList[i]);
                }
                controller.editorColliderList = null;
            }
            if (Application.isPlaying)
            {
                EditorGUILayout.LabelField("=============== Runtime Debug");

                if (GUILayout.Button("Refresh point", GUILayout.Height(22.0f)))
                {
                    controller.RestorePoint();
                }
                if (GUILayout.Button("Force refresh point", GUILayout.Height(22.0f)))
                {
                    controller.Reset();
                }
            }

            controller.isGenerateColliderAutomaitc = EditorGUILayout.Toggle("Is Generate Body Collider Automatic ", controller.isGenerateColliderAutomaitc);
            if (controller.isGenerateColliderAutomaitc)
            {
                controller.isGenerateByFixedPoint = EditorGUILayout.Toggle("Is Generate By Fixed Point ", controller.isGenerateByFixedPoint);
            }


            if (controller.editorColliderList != null)
            {
                EditorGUILayout.PropertyField(serializedObject.FindProperty("editorColliderList"), new GUIContent("Collider"), true);
            }

            Titlebar("physical setting", new Color(0.7f, 1.0f, 0.7f));
            EditorGUILayout.PropertyField(serializedObject.FindProperty("settings"), new GUIContent("Global Setting"), true);
            controller.isDebug = EditorGUILayout.Toggle("isDebug", controller.isDebug);
            if (controller.isDebug)
            {
                controller.iteration = EditorGUILayout.IntSlider("Iterations number", controller.iteration, 1, 1024);
            }
            else
            {
                controller.iteration = EditorGUILayout.IntSlider("Iterations number", controller.iteration, 4, 256);
            }
            controller.delayTime             = EditorGUILayout.FloatField("delayTime", controller.delayTime);
            controller.windScale             = EditorGUILayout.Slider("windForcePower", controller.windScale, 0, 1);
            controller.colliderCollisionType = (ColliderCollisionType)EditorGUILayout.EnumPopup("Collision Quantity", controller.colliderCollisionType);

            /*
             * if (GUILayout.Button("test", GUILayout.Height(22.0f)))
             * {
             *  BoneSubdivision();
             * }
             */
            serializedObject.ApplyModifiedProperties();
        }
Exemplo n.º 3
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            //OYM:更新表现形式;

            if (!Application.isPlaying)
            {
                EditorGUILayout.PropertyField(serializedObject.FindProperty("settings"), new GUIContent("Global Setting"), true);

                Titlebar("=============== Point setting", new Color(0.7f, 1.0f, 0.7f));
                controller.generateTransform = (Transform)EditorGUILayout.ObjectField(new GUIContent("parent Transform"), controller.generateTransform, typeof(Transform), true);
                EditorGUILayout.PropertyField(serializedObject.FindProperty("generateKeyWordWhiteList"), new GUIContent("Name KeyWord"), true);
                EditorGUILayout.PropertyField(serializedObject.FindProperty("blackListOfGenerateTransform"), new GUIContent("Transform BlackList"), true);
                EditorGUILayout.PropertyField(serializedObject.FindProperty("generateKeyWordBlackList"), new GUIContent("Name Key Word BlackList"), true);

                if (GUILayout.Button("Generate Point", GUILayout.Height(22.0f)))
                {
                    controller.initializePoint();
                    controller.isDebug = true;
                }

                if (controller.allPointTrans != null)
                {
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("allPointTrans"), new GUIContent("All point list :" + controller.allPointTrans?.Count), true);
                    GUILayout.Space(5);
                }

                Titlebar("=============== Collider setting", new Color(0.7f, 1.0f, 0.7f));
                string key = controller.isGenerateColliderAutomaitc ? "Generate" : "Refresh";

                if (GUILayout.Button(key + "Collider", GUILayout.Height(22.0f)))
                {
                    controller.initializeCollider();
                    controller.isDebug = true;
                }
                controller.isGenerateColliderAutomaitc = EditorGUILayout.Toggle("┗━Is Generate Body Collider Automatic ", controller.isGenerateColliderAutomaitc);
                if (controller.isGenerateColliderAutomaitc)
                {
                    controller.isGenerateByFixedPoint = EditorGUILayout.Toggle("   ┗━Is Generate By Fixed Point ", controller.isGenerateByFixedPoint);
                }

                if (GUILayout.Button("Remove All Collider", GUILayout.Height(22.0f)))
                {
                    if (controller.editorColliderList == null)
                    {
                        return;
                    }
                    if (isDeleteCollider)
                    {
                        for (int i = 0; i < controller.editorColliderList.Count; i++)
                        {
                            DestroyImmediate(controller.editorColliderList[i]);
                        }
                        isDeleteCollider = false;
                    }
                    controller.editorColliderList = null;
                }
                isDeleteCollider = EditorGUILayout.Toggle("is Delete Collider Script", isDeleteCollider);

                if (controller.editorColliderList != null)
                {
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("editorColliderList"), new GUIContent("All Collider List :" + controller.editorColliderList?.Count), true);
                }

                controller.delayTime = EditorGUILayout.FloatField("delayTime", controller.delayTime);
                Titlebar("=============== physical setting", new Color(0.7f, 1.0f, 0.7f));
            }
            else
            {
                Titlebar("RuntimeMode", new Color(0.5F, 1, 1));
                EditorGUILayout.PropertyField(serializedObject.FindProperty("settings"), new GUIContent("Global Setting"), true);
                EditorGUILayout.Space(10);

                Titlebar("=============== Point setting", new Color(0.5F, 1, 1));

                if (GUILayout.Button("Refresh Point Position", GUILayout.Height(22.0f)))
                {
                    controller.RestorePoint();
                }
                if (GUILayout.Button("Refresh All Point Data", GUILayout.Height(22.0f)))
                {
                    controller.Reset();
                }
                if (controller.allPointTrans != null)
                {
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("allPointTrans"), new GUIContent("All point list :" + controller.allPointTrans?.Count), true);
                }

                Titlebar("=============== Collider setting", new Color(0.5F, 1, 1));
                EditorGUILayout.Space(5);
                if (GUILayout.Button("RefreshColliderGizmo", GUILayout.Height(22.0f)))
                {
                    for (int i = 0; i < controller.editorColliderList.Count; i++)
                    {
                        controller.editorColliderList[i].Refresh();
                    }
                    controller.isDebug = true;
                }

                if (controller.editorColliderList != null)
                {
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("editorColliderList"), new GUIContent("All Collider List :" + controller.editorColliderList?.Count), true);
                }
                Titlebar("=============== physical setting", new Color(0.5F, 1, 1));
            }


            controller.isDebug    = EditorGUILayout.Toggle("isDebug", controller.isDebug);
            controller.isOptimize = EditorGUILayout.Toggle("OptimizeMove", controller.isOptimize);
            max = max > controller.iteration?max : Mathf.CeilToInt(controller.iteration * 1.1f);
            max = max > 2048 ? 2048 : max;
            controller.iteration             = EditorGUILayout.IntSlider("Iterations number", controller.iteration, 1, max);
            controller.windForceScale        = EditorGUILayout.Slider("windForcePower", controller.windForceScale, 0, 1);
            controller.colliderCollisionType = (ColliderCollisionType)EditorGUILayout.EnumPopup("Collision Quantity", controller.colliderCollisionType);
            serializedObject.ApplyModifiedProperties();
        }