private void OnGUI()
        {
            if (m_ActiveGameObjects == null || m_ActiveGameObjects.Length == 0 || m_ActiveGameObjects[0] == null)
            {
                return;
            }

            using (EditorGUILayoutEx.ScrollView(ref m_ScrollPosition))
            {
                foreach (var i in m_ActiveSpyglassEditors)
                {
                    using (GUILayoutEx.Vertical())
                    {
                        i.Item2 = EditorGUILayout.InspectorTitlebar(i.Item2, ((Editor)i.Item1).target);
                        if (i.Item2)
                        {
                            try
                            {
                                i.Item1.OnSpyglassGUI();
                            }
                            catch (Exception e)
                            {
                                if (GUIUtilityEx.ShouldRethrowException(e))
                                {
                                    throw;
                                }

                                Debug.LogException(e);
                            }
                        }
                    }
                }
            }
        }
Example #2
0
        protected override void OnShow()
        {
            GUILayout.BeginVertical();
            AssetUpdateConfiger.GetInstance().assetPath = GUILayoutEx.ShowPathBar("资源目录", AssetUpdateConfiger.GetInstance().assetPath);


            GUILayout.EndVertical();
        }
        public void OnSpyglassGUI()
        {
            var controller = AssetDatabase.LoadAssetAtPath <AnimatorController>(AssetDatabase.GetAssetPath(target.runtimeAnimatorController));

            if (controller == null)
            {
                return;
            }

            using (EditorGUILayoutEx.ScrollView(ref m_ScrollPosition))
            {
                using (GUILayoutEx.Vertical())
                {
                    foreach (AnimatorControllerParameter parameter in controller.parameters)
                    {
                        switch (parameter.type)
                        {
                        case AnimatorControllerParameterType.Float:
                        {
                            float value = target.GetFloat(parameter.name);
                            using (EditorGUIEx.ChangeCheck(() => target.SetFloat(parameter.name, value)))
                            {
                                value = EditorGUILayout.FloatField(parameter.name, value);
                            }
                        }
                        break;

                        case AnimatorControllerParameterType.Int:
                        {
                            int value = target.GetInteger(parameter.name);
                            using (EditorGUIEx.ChangeCheck(() => target.SetInteger(parameter.name, value)))
                            {
                                value = EditorGUILayout.IntField(parameter.name, value);
                            }
                        }
                        break;

                        case AnimatorControllerParameterType.Bool:
                        {
                            bool value = target.GetBool(parameter.name);
                            using (EditorGUIEx.ChangeCheck(() => target.SetBool(parameter.name, value)))
                            {
                                value = EditorGUILayout.Toggle(parameter.name, value);
                            }
                        }
                        break;

                        case AnimatorControllerParameterType.Trigger:
                            if (GUILayout.Button(parameter.name))
                            {
                                target.SetTrigger(parameter.name);
                            }
                            break;
                        }
                    }
                }
            }
        }
Example #4
0
 private void MainTextGUI(MaterialEditor materialEditor, Material[] materials)
 {
     if (this.CheckOption(materials, "Enable Main", "ENABLE_MAIN"))
     {
         GUILayoutEx.BeginContents();
         materialEditor.TextureProperty(this.mainTex, this.mainTex.displayName);
         GUILayoutEx.EndContents();
     }
 }
Example #5
0
 private void NormalMapGUI(MaterialEditor materialEditor, Material[] materials)
 {
     if (this.CheckOption(materials, "Enable Normal", "ENABLE_NORMAL"))
     {
         GUILayoutEx.BeginContents();
         materialEditor.TextureProperty(this.normalMap, this.normalMap.displayName);
         GUILayoutEx.EndContents();
     }
 }
        void OnGUI()
        {
            if (animators.Count == 0)
            {
                FindAnimationControllers();
            }

            using (EditorGUILayoutEx.ScrollView(ref m_ScrollPosition))
            {
                using (GUILayoutEx.Horizontal())
                {
                    GUILayout.Label(EditorApplication.isPlaying ? "Runtime Animator Controllers:" : "Project Animator Controllers:", EditorStyles.boldLabel);
                    if (GUILayout.Button("Refresh", GUILayout.Width(80)))
                    {
                        FindAnimationControllers();
                    }
                }

                FieldInfo    m_PreviewAnimator    = m_AnimatorControllerToolType.GetField("m_PreviewAnimator", BindingFlags.Instance | BindingFlags.NonPublic);
                PropertyInfo m_AnimatorController = m_AnimatorControllerToolType.GetProperty("animatorController", BindingFlags.Instance | BindingFlags.Public);

                foreach (var a in animators)
                {
                    using (GUILayoutEx.Horizontal())
                    {
                        if (a.animator == null)
                        {
                            if (GUILayout.Button("{0}".format(a.controller.name), GUILayout.Height(20)))
                            {
                                EditorWindow m_AnimatorControllerTool = GetWindow(m_AnimatorControllerToolType);
                                m_AnimatorController.SetValue(m_AnimatorControllerTool, a.controller, null);
                                m_AnimatorControllerTool.Repaint();
                            }
                            if (GUILayout.Button(new GUIContent("S", "Show animator in hierarchy view."), GUILayout.Width(20)))
                            {
                                EditorGUIUtility.PingObject(AssetDatabase.LoadMainAssetAtPath(a.path));
                            }
                        }
                        else
                        {
                            if (GUILayout.Button("{0}: {1}".format(a.animator.name, a.controller.name), GUILayout.Height(20)))
                            {
                                EditorWindow m_AnimatorControllerTool = GetWindow(m_AnimatorControllerToolType);
                                m_PreviewAnimator.SetValue(m_AnimatorControllerTool, a.animator);
                                m_AnimatorController.SetValue(m_AnimatorControllerTool, a.controller, null);
                                m_AnimatorControllerTool.Repaint();
                            }
                            if (GUILayout.Button(new GUIContent("S", "Show animator in hierarchy view."), GUILayout.Width(20)))
                            {
                            }
                        }
                    }
                }
            }
        }
Example #7
0
 private void SpecularGUI(MaterialEditor materialEditor, Material[] materials)
 {
     if (this.CheckOption(materials, "Enable Specular", "ENABLE_SPECULAR"))
     {
         GUILayoutEx.BeginContents();
         EditorGUI.indentLevel = 1;
         materialEditor.ColorProperty(this.specularColor, this.specularColor.displayName);
         EditorGUI.indentLevel = 0;
         GUILayoutEx.EndContents();
     }
 }
Example #8
0
 private void DiffuseGUI(MaterialEditor materialEditor, Material[] materials)
 {
     if (this.CheckOption(materials, "Enable Diffuse", "ENABLE_DIFFUSE"))
     {
         GUILayoutEx.BeginContents();
         EditorGUI.indentLevel = 1;
         materialEditor.ColorProperty(this.diffuseColor, this.diffuseColor.displayName);
         EditorGUI.indentLevel = 0;
         GUILayoutEx.EndContents();
     }
 }
Example #9
0
 private void AmbianceGUI(MaterialEditor materialEditor, Material[] materials)
 {
     if (this.CheckOption(materials, "Enable Ambiance", "ENABLE_AMBIANCE"))
     {
         GUILayoutEx.BeginContents();
         EditorGUI.indentLevel = 1;
         materialEditor.ColorProperty(this.ambianceColor, this.ambianceColor.displayName);
         EditorGUI.indentLevel = 0;
         GUILayoutEx.EndContents();
     }
 }
Example #10
0
 private void HightMapGUI(MaterialEditor materialEditor, Material[] materials)
 {
     if (this.CheckOption(materials, "Enable Height", "ENABLE_HEIGHT"))
     {
         GUILayoutEx.BeginContents();
         materialEditor.TextureProperty(this.heightMap, this.heightMap.displayName);
         materialEditor.ColorProperty(this.waterColor1, this.waterColor1.displayName);
         materialEditor.ColorProperty(this.waterColor2, this.waterColor2.displayName);
         GUILayoutEx.EndContents();
     }
 }
Example #11
0
 private void RefrationGUI(MaterialEditor materialEditor, Material[] materials)
 {
     if (this.CheckOption(materials, "Enable Refraction", "ENABLE_REFRACTION"))
     {
         GUILayoutEx.BeginContents();
         EditorGUI.indentLevel = 1;
         materialEditor.RangeProperty(this.refractionDistort, this.refractionDistort.displayName);
         materialEditor.RangeProperty(this.refractionOpacity, this.refractionOpacity.displayName);
         EditorGUI.indentLevel = 0;
         GUILayoutEx.EndContents();
     }
 }
Example #12
0
 private void ReflectionGUI(MaterialEditor materialEditor, Material[] materials)
 {
     if (this.CheckOption(materials, "Enable Reflection", "ENABLE_REFLECTION"))
     {
         GUILayoutEx.BeginContents();
         EditorGUI.indentLevel = 1;
         materialEditor.TexturePropertySingleLine(new GUIContent(this.reflection.displayName), this.reflection);
         materialEditor.RangeProperty(this.reflectionSpace, this.reflectionSpace.displayName);
         materialEditor.RangeProperty(this.reflectPower, this.reflectPower.displayName);
         EditorGUI.indentLevel = 0;
         GUILayoutEx.EndContents();
     }
 }
        private void OnGui(Rect position, ButtonDropWindow.Styles styles)
        {
            GUI.Label(new Rect(0.0f, 0.0f, position.width, position.height), GUIContent.none, styles.background);

            var rect = position;

            rect.x      = +1f;
            rect.y      = +0f;
            rect.width -= 2f;
            //rect.height -= 2f;

            using (GUILayoutEx.Area(rect))
            {
                rect = GUILayoutUtility.GetRect(10f, 25f);
                GUI.Label(rect, "New Script", styles.header);

                GUILayout.Label("Name:");
                m_ScriptName = EditorGUILayout.TextField(m_ScriptName);

                GUILayout.Label("Namespace:");
                using (GUILayoutEx.Horizontal())
                {
                    m_Namespace = EditorGUILayout.TextField(m_Namespace);
                    if (GUILayout.Button("S", GUILayout.Width(20)))
                    {
                    }
                }

                GUILayout.Label("Path:");
                using (GUILayoutEx.Horizontal())
                {
                    m_Path = EditorGUILayout.TextField(m_Path);
                    if (GUILayout.Button("S", GUILayout.Width(20)))
                    {
                    }
                }

                string scriptPath = Path.Combine(m_Path, m_ScriptName + ".cs");
                using (EditorGUIEx.DisabledScopeIf(File.Exists(scriptPath)))
                {
                    if (GUILayout.Button("Create and Add"))
                    {
                        CreateScript(scriptPath);

                        ButtonDropWindow.Close();
                    }
                }
            }
        }
Example #14
0
        protected override void OnShow()
        {
            GUILayout.BeginVertical();
            if (GUILayout.Button("同步"))
            {
                AssetSyncManager.GetInstance().Sync();
            }

            AssetSyncConfiger.GetInstance().minVersion         = EditorGUILayout.IntField("最小同步版本", AssetSyncConfiger.GetInstance().minVersion);
            AssetSyncConfiger.GetInstance().repositoryRootPath = GUILayoutEx.ShowPathBar("版本库路径", AssetSyncConfiger.GetInstance().repositoryRootPath);


            m_itemSortedList.DoLayoutList();

            GUILayout.EndVertical();
        }
Example #15
0
    private void WaveGUI(MaterialEditor materialEditor, Material[] materials)
    {
        if (this.HasKeyword(materials, "ENABLE_NORMAL") || this.HasKeyword(materials, "ENABLE_HEIGHT"))
        {
            GUILayoutEx.BeginContents();
            GUILayout.Label("Wave Parameter:");
            materialEditor.VectorProperty(this.wavex1y1x2y2, this.wavex1y1x2y2.displayName);
            materialEditor.VectorProperty(this.waveSmallx1y1x2y2, this.waveSmallx1y1x2y2.displayName);

            if (this.CheckOption(materials, "Enable Wave Animation", "ENABLE_WAVE_ANIMATION"))
            {
                materialEditor.RangeProperty(this.waterSpeed, this.waterSpeed.displayName);
            }
            GUILayoutEx.EndContents();
        }
    }
Example #16
0
        protected override void OnShow()
        {
            GUILayout.BeginVertical();
            if (GUILayout.Button("处理"))
            {
                AssetProcesserManager.GetInstance().Do();
            }

            AssetProcesserConfiger.GetInstance().outputFolderPath          = GUILayoutEx.ShowPathBar("后处理输出目录", AssetProcesserConfiger.GetInstance().outputFolderPath);
            AssetProcesserConfiger.GetInstance().processFolderName         = EditorGUILayout.TextField("处理文件目录名", AssetProcesserConfiger.GetInstance().processFolderName);
            AssetProcesserConfiger.GetInstance().checkfileFolderName       = EditorGUILayout.TextField("检查文件目录名", AssetProcesserConfiger.GetInstance().checkfileFolderName);
            AssetProcesserConfiger.GetInstance().createFolderOrAddSuffix   = EditorGUILayout.Toggle("为检查文件创建存放目录", AssetProcesserConfiger.GetInstance().createFolderOrAddSuffix);
            AssetProcesserConfiger.GetInstance().useGUID4SaveCheckfileName = EditorGUILayout.Toggle("用GUID作为检查文件名", AssetProcesserConfiger.GetInstance().useGUID4SaveCheckfileName);

            GUILayout.EndVertical();
        }
Example #17
0
 protected void ShowPathList()
 {
     GUILayout.Label("程序集路径配置:");
     foreach (var infos in AssembliesToolsConfig.GetInstance().buildPathList)
     {
         infos.srcPath     = GUILayoutEx.ShowPathBar("源资源路径", infos.srcPath);
         infos.buildPath   = GUILayoutEx.ShowPathBar("临时导出路径", infos.buildPath);
         infos.projectPath = GUILayoutEx.ShowPathBar("映射路径", infos.projectPath);
         if (GUILayout.Button("移除"))
         {
             AssembliesToolsConfig.GetInstance().buildPathList.Remove(infos);
             return;
         }
         EditorGUILayout.Space();
     }
     if (GUILayout.Button("...."))
     {
         AssembliesBuildInfos info = new AssembliesBuildInfos();
         var pathList = AssembliesToolsConfig.GetInstance().buildPathList;
         pathList.Add(info);
     }
 }
Example #18
0
        protected void ShowPathList()
        {
            GUILayout.Label("资源配置路径:");
            foreach (var infos in ResourceConfig.GetInstance().resPathList)
            {
                infos.key     = EditorGUILayout.TextField("资源名(Key)", infos.key);
                infos.srcPath = GUILayoutEx.ShowPathBar("源资源路径", infos.srcPath);

                if (GUILayout.Button("移除"))
                {
                    ResourceConfig.GetInstance().resPathList.Remove(infos);
                    return;
                }
                EditorGUILayout.Space();
            }
            if (GUILayout.Button("...."))
            {
                ResourcePathConfigInfos info = new ResourcePathConfigInfos();
                var pathList = ResourceConfig.GetInstance().resPathList;
                pathList.Add(info);
            }
        }
Example #19
0
        protected override void OnShow()
        {
            GUILayout.BeginVertical();
            m_scrollPos = GUI.BeginScrollView(new Rect(0, 0, position.width, position.height), m_scrollPos, new Rect(0, 0, position.width, 1000));
            //标题
            GUILayout.Space(10);
            GUILayout.Label("打包配置", new GUIStyle(GUI.skin.label)
            {
                fontSize = 24, alignment = TextAnchor.MiddleCenter
            });
            if (GUILayout.Button("打包"))
            {
                AssetBuilderManager.GetInstance().Build();
            }

            AssetBuildConfiger.GetInstance().targetType             = (AssetBuildConfiger.BuildPlatform)EditorGUILayout.EnumPopup("当前平台", AssetBuildConfiger.GetInstance().targetType);
            AssetBuildConfiger.GetInstance().exportFolder           = GUILayoutEx.ShowPathBar("输出目录", AssetBuildConfiger.GetInstance().exportFolder);
            AssetBuildConfiger.GetInstance().shareBundleName        = EditorGUILayout.TextField("公共包名", AssetBuildConfiger.GetInstance().shareBundleName);
            AssetBuildConfiger.GetInstance().isCombinePlatformName  = EditorGUILayout.Toggle("输出目录拼接平台名称", AssetBuildConfiger.GetInstance().isCombinePlatformName);
            AssetBuildConfiger.GetInstance().isOptimzeShareBundle   = EditorGUILayout.Toggle("优化Share打包", AssetBuildConfiger.GetInstance().isOptimzeShareBundle);
            AssetBuildConfiger.GetInstance().isRidofSpecialChar     = EditorGUILayout.Toggle("包名移除特殊字符", AssetBuildConfiger.GetInstance().isRidofSpecialChar);
            AssetBuildConfiger.GetInstance().isUseDependenciesCache = EditorGUILayout.Toggle("使用依赖缓存加速", AssetBuildConfiger.GetInstance().isUseDependenciesCache);

            m_itemSortedList.DoLayoutList();
            EditorGUILayout.HelpBox("包路径说明\n" +
                                    "{assetEx}资源后缀" +
                                    "{assetRootPath}资源父路径" +
                                    "{assetNameNotEx}资源不带后缀名" +
                                    "{assetName}资源名" +
                                    "{assetKey}资源名中到_的部分" +
                                    "{assetFlatPath}资源扁平化路径" +
                                    "{buildName}构建器名", MessageType.Info);

            GUI.EndScrollView();
            GUILayout.EndVertical();
        }
Example #20
0
 protected void ShowModulePath()
 {
     ResourceConfig.GetInstance().resModulePath = GUILayoutEx.ShowPathBar("工具模块路径", ResourceConfig.GetInstance().resModulePath);
 }
Example #21
0
    /// <inheritdoc/>
    public override void OnInspectorGUI()
    {
        this.serializedObject.Update();

        // Try to find shaders if missing.
        if (this.downSampleShader.objectReferenceValue == null)
        {
            this.downSampleShader.objectReferenceValue =
                Shader.Find("Game/PostEffect/DownSample");
        }

        if (this.brightPassShader.objectReferenceValue == null)
        {
            this.brightPassShader.objectReferenceValue =
                Shader.Find("Game/PostEffect/BrightPass");
        }

        if (this.blurPassShader.objectReferenceValue == null)
        {
            this.blurPassShader.objectReferenceValue =
                Shader.Find("Game/PostEffect/BlurPass");
        }

        if (this.combinePassShader.objectReferenceValue == null)
        {
            this.combinePassShader.objectReferenceValue =
                Shader.Find("Game/PostEffect/CombinePass");
        }

        // Show the post effect shader.
        this.downSampleShader.isExpanded = EditorGUILayout.ToggleLeft(
            "Show Shaders",
            this.downSampleShader.isExpanded);
        if (this.downSampleShader.isExpanded)
        {
            GUILayoutEx.BeginContents();
            EditorGUILayout.PropertyField(this.downSampleShader);
            EditorGUILayout.PropertyField(this.brightPassShader);
            EditorGUILayout.PropertyField(this.blurPassShader);
            EditorGUILayout.PropertyField(this.combinePassShader);
            GUILayoutEx.EndContents();
        }

        // Bloom
        this.enableBloom.boolValue = EditorGUILayout.ToggleLeft(
            this.enableBloom.displayName,
            this.enableBloom.boolValue);
        if (this.enableBloom.boolValue)
        {
            GUILayoutEx.BeginContents();
            EditorGUILayout.PropertyField(this.bloomBlendMode);
            EditorGUILayout.PropertyField(this.bloomIntensity);
            EditorGUILayout.PropertyField(this.bloomThreshold);
            EditorGUILayout.PropertyField(this.bloomThresholdColor);
            EditorGUILayout.PropertyField(this.bloomBlurSpread);
            GUILayoutEx.EndContents();
        }

        // Color curve.
        this.enableColorCurve.boolValue = EditorGUILayout.ToggleLeft(
            this.enableColorCurve.displayName,
            this.enableColorCurve.boolValue);
        if (this.enableColorCurve.boolValue)
        {
            GUILayoutEx.BeginContents();
            EditorGUILayout.PropertyField(this.redChannelCurve);
            EditorGUILayout.PropertyField(this.greenChannelCurve);
            EditorGUILayout.PropertyField(this.blueChannelCurve);
            GUILayoutEx.EndContents();
        }

        // Saturation
        this.enableSaturation.boolValue = EditorGUILayout.ToggleLeft(
            this.enableSaturation.displayName,
            this.enableSaturation.boolValue);
        if (this.enableSaturation.boolValue)
        {
            GUILayoutEx.BeginContents();
            EditorGUILayout.PropertyField(this.saturation);
            GUILayoutEx.EndContents();
        }

        // SaturationSup
        this.enableSaturationSup.boolValue = EditorGUILayout.ToggleLeft(
            this.enableSaturationSup.displayName,
            this.enableSaturationSup.boolValue);
        GUILayoutEx.BeginContents();
        EditorGUILayout.PropertyField(this.saturationSup);
        GUILayoutEx.EndContents();

        // Vignette
        this.enableVignette.boolValue = EditorGUILayout.ToggleLeft(
            this.enableVignette.displayName,
            this.enableVignette.boolValue);
        if (this.enableVignette.boolValue)
        {
            GUILayoutEx.BeginContents();
            EditorGUILayout.PropertyField(this.vignetteIntensity);
            GUILayoutEx.EndContents();
        }

        this.serializedObject.ApplyModifiedProperties();
    }
Example #22
0
        void OnGUI()
        {
            if (scenes.Count == 0)
            {
                FindSceneInProject();
            }

            using (EditorGUILayoutEx.ScrollView(ref m_ScrollPosition))
            {
                List <string> lastFolders = new List <string>();

                bool bRefresh = false;
                foreach (string folder in scenes.Keys.OrderBy(s => s))
                {
                    if (!foldouts[folder])
                    {
                        lastFolders.Add(folder);
                        continue;
                    }

                    using (GUILayoutEx.Horizontal())
                    {
                        foldouts[folder] = EditorGUILayout.Foldout(foldouts[folder], "{0}:".format(folder) /*, EditorStyles.boldLabel*/);
                        if (!bRefresh && GUILayout.Button("Refresh", GUILayout.Width(80)))
                        {
                            scenes.Clear();
                            break;
                        }
                        bRefresh = true;
                    }

                    if (foldouts[folder])
                    {
                        foreach (string sceneName in scenes[folder])
                        {
                            using (GUILayoutEx.Horizontal())
                            {
                                if (GUILayout.Button(Path.GetFileName(sceneName), GUILayout.Height(20)))
                                {
                                    if (EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo())
                                    {
                                        EditorSceneManager.OpenScene(sceneName);
                                    }
                                }
                                if (GUILayout.Button(new GUIContent("S", "Show scene in project view."), GUILayout.Width(20)))
                                {
                                    EditorGUIUtility.PingObject(AssetDatabase.LoadMainAssetAtPath(sceneName));
                                }
                            }
                        }
                    }
                }

                foreach (string folder in lastFolders)
                {
                    using (GUILayoutEx.Horizontal())
                    {
                        foldouts[folder] = EditorGUILayout.Foldout(foldouts[folder], "{0}:".format(folder) /*, EditorStyles.boldLabel*/);
                        if (!bRefresh && GUILayout.Button("Refresh", GUILayout.Width(80)))
                        {
                            scenes.Clear();
                            break;
                        }
                        bRefresh = true;
                    }
                }
            }
        }
Example #23
0
    void OnGUI()
    {
        if (normalStyle == null)
        {
            normalStyle = new GUIStyle();
            normalStyle.normal.textColor = Color.red;
        }

        if (particleStyle == null)
        {
            particleStyle = new GUIStyle();
            particleStyle.normal.textColor = Color.green;
        }

        if (ragdollStyle == null)
        {
            ragdollStyle = new GUIStyle();
            ragdollStyle.normal.textColor = Color.white;
        }

        targetObj = (GameObject)EditorGUILayout.ObjectField("目标角色", targetObj, typeof(GameObject), true);
        if (targetObj != null)
        {
            ////init
            if (orignObj == null)
            {
                initParams(targetObj);
                orignObj = targetObj;
                return;
            }

            if (targetObj != orignObj)
            {
                EditorGUILayout.BeginHorizontal();
                if (GUILayoutEx.Button("更换模型", Color.red))
                {
                    initParams(targetObj);
                    orignObj = targetObj;
                }

                if (GUILayoutEx.Button("恢复模型", Color.green))
                {
                    targetObj = orignObj;
                }
                EditorGUILayout.EndHorizontal();
                return;
            }

            useDismember = EditorGUILayout.Toggle("是否使用Dismember", useDismember);
            if (useDismember)
            {
                //////init components
                if (dismember == null)
                {
                    if (targetObj.GetComponent <Dismemberment>() == null)
                    {
                        dismember = targetObj.AddComponent <Dismemberment>();
                        CreateWithDefaultParam();
                    }
                    else
                    {
                        dismember = targetObj.GetComponent <Dismemberment>();
                    }
                    initParams(targetObj);
                }
            }

            if (ragdollManager == null)
            {
                //todo:动物布娃娃不初始化,只进行操作
                if (targetObj.GetComponent <RagdollManagerGen>() != null)
                {
                    ragdollManager = targetObj.GetComponent <RagdollManagerGen>();
                }
                else
                {
                    if (targetObj.GetComponent <RagdollManagerHum>() == null)
                    {
                        ragdollManager = targetObj.AddComponent <RagdollManagerHum>();
                        ragdollManager.onCreateCompeleted = CreateWithDefaultParam;
                        ((RagdollManagerHum)ragdollManager).DefaultInitialize();
                    }
                    else
                    {
                        ragdollManager = targetObj.GetComponent <RagdollManagerHum>();
                    }
                }
                initParams(targetObj);
            }

            //Copy from copyTarget
            copyTarget = (GameObject)EditorGUILayout.ObjectField("拷贝角色", copyTarget, typeof(GameObject), true);

            if (copyTarget != null && copyTarget.GetComponent <Dismemberment>() != null &&
                copyTarget.GetComponent <RagdollManagerHum>() != null && isCopying == false)
            {
                if (GUILayoutEx.Button("拷贝参数", Color.yellow))
                {
                    isCopying = true;
                }
            }
            if (isCopying == true)
            {
                EditorGUILayout.BeginHorizontal();
                if (GUILayoutEx.Button("确认拷贝", Color.red))
                {
                    CopyParamFromTarget(targetObj, copyTarget);
                    initParams(targetObj);
                    copyParam = true;
                    isCopying = false;
                }
                if (GUILayoutEx.Button("恢复", Color.green))
                {
                    isCopying = false;
                }
                EditorGUILayout.EndHorizontal();
                return;
            }

            scrollPos = EditorGUILayout.BeginScrollView(scrollPos);
            if (useDismember)
            {
                //////Dismember
                GUILayout.Label("肢解设置", EditorStyles.boldLabel);

                limbTransRoot      = (Transform)EditorGUILayout.ObjectField("肢解根节点:", limbTransRoot, typeof(Transform), true);
                dismember.LimbRoot = limbTransRoot;

                dismemberNum = EditorGUILayout.IntField("肢解方案个数:", dismemberNum);
                if (dismemberNum != dismember.BoomParamsNum && !copyParam)
                {
                    EditorGUILayout.BeginHorizontal();
                    if (GUILayoutEx.Button("确定更改方案数", Color.red))
                    {
                        dismember.BoomParamsNum = dismemberNum;
                    }
                    if (GUILayoutEx.Button("恢复方案数", Color.green))
                    {
                        dismemberNum = dismember.BoomParamsNum;
                    }
                    EditorGUILayout.EndHorizontal();
                }
                //Scroll Dismember
                else
                {
                    copyParam = false;
                    if (dismemberNum > 0)
                    {
                        var boomParam = dismember.boomParam;
                        for (int i = 0; i < dismemberNum; i++)
                        {
                            string normalText = string.Format("-------------------------方案{0}-------------------------", i + 1);
                            EditorGUILayout.LabelField(normalText, normalStyle);
                            var temp = boomParam[i];
                            dismemberTarget[i]     = (GameObject)EditorGUILayout.ObjectField("被肢解目标:", dismemberTarget[i], typeof(GameObject), true);
                            temp.targetObj         = dismemberTarget[i];
                            dismemberColliders[i]  = (Collider)EditorGUILayout.ObjectField("肢解碰撞体:", dismemberColliders[i], typeof(Collider), true);
                            temp.collider          = dismemberColliders[i];
                            dismemberRigidbodys[i] = (Rigidbody)EditorGUILayout.ObjectField("被肢解目标:", dismemberRigidbodys[i], typeof(Rigidbody), true);
                            temp.rigidbody         = dismemberRigidbodys[i];
                            bodyPart[i]            = (Dismemberment.BodyPartHint)EditorGUILayout.EnumPopup("肢解部位:", bodyPart[i]);
                            temp.bodyPart          = (Dismemberment.BodyPartHint)bodyPart[i];

                            ////ignore Ragdoll Effect
                            //ignoreRagdollNum[i] = EditorGUILayout.IntField("忽略布娃娃效果个数:", ignoreRagdollNum[i]);

                            //if (ignoreRagdollNum[i] != temp.IgnoreRagdollEffectNum)
                            //{
                            //    EditorGUILayout.BeginHorizontal();
                            //    if (GUILayoutEx.Button("确定更改", Color.red)) temp.IgnoreRagdollEffectNum = ignoreRagdollNum[i];
                            //    if (GUILayoutEx.Button("恢复", Color.green)) ignoreRagdollNum[i] = temp.IgnoreRagdollEffectNum;
                            //    EditorGUILayout.EndHorizontal();
                            //}
                            //else
                            //{
                            //    copyParam = false;
                            //    if (ignoreRagdollNum[i] > 0)
                            //    {
                            //        for (int j = 0; j < ignoreRagdollNum[i]; j++)
                            //        {
                            //            string particleText = string.Format("-------------------------忽略{0}-------------------------", j + 1);
                            //            var ignoreRagdollParam = temp.ignoreRagdollTrans[j];
                            //            ignoreRagdollTrans[dismemberParamNum * i + j] = (Transform)EditorGUILayout.ObjectField("忽略布娃娃效果:", ignoreRagdollTrans[dismemberParamNum * i + j], typeof(Transform), true);
                            //            ignoreRagdollParam = ignoreRagdollTrans[dismemberParamNum * i + j];
                            //        }
                            //    }
                            //}

                            //particle
                            particleNum[i] = EditorGUILayout.IntField("特效个数:", particleNum[i]);

                            if (particleNum[i] != temp.ParticleNum && !copyParam)
                            {
                                EditorGUILayout.BeginHorizontal();
                                if (GUILayoutEx.Button("确定更改特效数", Color.red))
                                {
                                    temp.ParticleNum = particleNum[i];
                                }
                                if (GUILayoutEx.Button("恢复特效数", Color.green))
                                {
                                    particleNum[i] = temp.ParticleNum;
                                }
                                EditorGUILayout.EndHorizontal();
                            }
                            else
                            {
                                copyParam = false;
                                if (particleNum[i] > 0)
                                {
                                    for (int j = 0; j < particleNum[i]; j++)
                                    {
                                        string particleText = string.Format("-------------------------特效{0}-------------------------", j + 1);
                                        EditorGUILayout.LabelField(particleText, particleStyle);
                                        var particleParm = temp.particles[j];
                                        particleNames[dismemberParamNum * i + j] = EditorGUILayout.TextField("特效名称", particleNames[dismemberParamNum * i + j]);
                                        particleParm.ParticleName = particleNames[dismemberParamNum * i + j];
                                        particleRoot[dismemberParamNum * i + j] = (Transform)EditorGUILayout.ObjectField("特效起始位置父节点:", particleRoot[dismemberParamNum * i + j], typeof(Transform), true);
                                        particleParm.particleRoot          = particleRoot[dismemberParamNum * i + j];
                                        initPos[dismemberParamNum * i + j] = EditorGUILayout.Vector3Field("特效初始位置:", initPos[dismemberParamNum * i + j]);
                                        particleParm.initPos = initPos[dismemberParamNum * i + j];
                                        initEurler[dismemberParamNum * i + j] = EditorGUILayout.Vector3Field("特效初始旋转位置:", initEurler[dismemberParamNum * i + j]);
                                        particleParm.initEurler = initEurler[dismemberParamNum * i + j];
                                        initScale[dismemberParamNum * i + j] = EditorGUILayout.Vector3Field("特效初始缩放:", initScale[dismemberParamNum * i + j]);
                                        particleParm.initScale = initScale[dismemberParamNum * i + j];
                                    }
                                }
                            }

                            //forceParam
                            forceNum[i] = EditorGUILayout.IntField("力参数个数:", forceNum[i]);

                            if (forceNum[i] != temp.ForceNum && !copyParam)
                            {
                                EditorGUILayout.BeginHorizontal();
                                if (GUILayoutEx.Button("确定更改特效数", Color.red))
                                {
                                    temp.ForceNum = forceNum[i];
                                }
                                if (GUILayoutEx.Button("恢复特效数", Color.green))
                                {
                                    forceNum[i] = temp.ForceNum;
                                }
                                EditorGUILayout.EndHorizontal();
                            }
                            else
                            {
                                if (forceNum[i] > 0)
                                {
                                    for (int j = 0; j < forceNum[i]; j++)
                                    {
                                        string forceParamText = string.Format("-------------------------力参数{0}-------------------------", j + 1);
                                        EditorGUILayout.LabelField(forceParamText, particleStyle);
                                        var forceParam = temp.forceParams[j];
                                        drag[dismemberParamNum * i + j] = EditorGUILayout.FloatField("摩擦力:", drag[dismemberParamNum * i + j]);
                                        forceParam.drag = drag[dismemberParamNum * i + j];
                                        angleDrag[dismemberParamNum * i + j] = EditorGUILayout.FloatField("角动量摩擦力:", angleDrag[dismemberParamNum * i + j]);
                                        forceParam.angleDrag             = angleDrag[dismemberParamNum * i + j];
                                        force[dismemberParamNum * i + j] = EditorGUILayout.Vector3Field("速度:", force[dismemberParamNum * i + j]);
                                        forceParam.force = force[dismemberParamNum * i + j];
                                        torque[dismemberParamNum * i + j] = EditorGUILayout.Vector3Field("角速度:", torque[dismemberParamNum * i + j]);
                                        forceParam.torque = torque[dismemberParamNum * i + j];
                                    }
                                }
                            }


                            EditorGUILayout.BeginHorizontal();
                            forceMethod = EditorGUILayout.IntField("肢解力方案选择:1~10:", forceMethod);
                            if (GUILayoutEx.Button("测试肢解", Color.yellow))
                            {
                                dismember.TestDismember(i * 10 + forceMethod - 1);
                            }
                            //if (GUILayoutEx.Button("恢复", Color.green)) dismember.ReCoverOne(i * 10 + forceMethod - 1);
                            EditorGUILayout.EndHorizontal();
                        }
                    }
                }
            }

            //////Ragdoll
            string ragdollText = string.Format("-------------------------布娃娃系统-------------------------");
            EditorGUILayout.LabelField(ragdollText, ragdollStyle);

            ragdollId    = EditorGUILayout.IntField("布娃娃受力点:", ragdollId);
            ragdollForce = EditorGUILayout.Vector3Field("布娃娃受力方向:", ragdollForce);

            EditorGUILayout.BeginHorizontal();

            if (GUILayout.Button("测试布娃娃"))
            {
                ragdollManager.DisableCustomRagdoll();
                var anim = targetObj.GetComponent <Animation>();
                if (anim != null)
                {
                    anim.enabled = false;
                }

                var characterControl = targetObj.GetComponent <CharacterController>();
                if (characterControl != null)
                {
                    characterControl.enabled = false;
                }

                ragdollManager.CustomRagdoll(ragdollId, ragdollForce);
            }

            if (GUILayout.Button("恢复布娃娃"))
            {
                ragdollManager.DisableCustomRagdoll();

                var anim = targetObj.GetComponent <Animation>();
                if (anim != null)
                {
                    anim.enabled = true;
                    anim.Play("idle");
                }

                var characterControl = targetObj.GetComponent <CharacterController>();
                if (characterControl != null)
                {
                    characterControl.enabled = true;
                }
            }

            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();

            //综合方案
            method = EditorGUILayout.IntField("方案选择 : 11~90:", method);
            if (GUILayout.Button("走你"))
            {
                ragdollManager.DisableCustomRagdoll();
                var anim = targetObj.GetComponent <Animation>();
                if (anim != null)
                {
                    anim.enabled = false;
                }

                var characterControl = targetObj.GetComponent <CharacterController>();
                if (characterControl != null)
                {
                    characterControl.enabled = false;
                }

                dismember.TestDismember(Mathf.Clamp(method - 10 - 1, 0, 79));

                ragdollManager.CustomRagdoll(ragdollId, ragdollForce);
            }

            if (GUILayout.Button("恢复"))
            {
                ragdollManager.DisableCustomRagdoll();

                var anim = targetObj.GetComponent <Animation>();
                if (anim != null)
                {
                    anim.enabled = true;
                    anim.Play("idle");
                }

                var characterControl = targetObj.GetComponent <CharacterController>();
                if (characterControl != null)
                {
                    characterControl.enabled = true;
                }
            }

            EditorGUILayout.EndHorizontal();
            EditorGUILayout.EndScrollView();
        }
    }