void OnGUI()
		{
			Scaling = (UIRoot.Scaling)EditorGUILayout.EnumPopup("Scaling Style", Scaling);
			
			if (Scaling == UIRoot.Scaling.Flexible)
			{
				MinimumHeight = EditorGUILayout.IntField("Minimum Height", MinimumHeight);
				MaximumHeight = EditorGUILayout.IntField("Maximum Height", MaximumHeight);
				ShrinkPortraitUI = EditorGUILayout.Toggle("Shrink Portrait UI", ShrinkPortraitUI);
				AdjustByDPI = EditorGUILayout.Toggle("Adjust by DPI", AdjustByDPI);
				
				EditorGUILayout.LabelField("结果按手机实际显示,非编辑器预览显示");
			}
			else
			{
				GUILayout.BeginHorizontal();
				ManualWidth = EditorGUILayout.IntField("Content Width", ManualWidth, GUILayout.Width(260f));
				FitWidth = EditorGUILayout.Toggle("Fit", FitWidth);
				GUILayout.EndHorizontal();
				
				GUILayout.BeginHorizontal();
				ManualHeight = EditorGUILayout.IntField("Content Height", ManualHeight, GUILayout.Width(260f));
				FitHeight = EditorGUILayout.Toggle("Fit", FitHeight);
				GUILayout.EndHorizontal();			
			}
			
			EditorGUILayout.Space();
			EditorGUILayout.Space();
			EditorGUILayout.Space();
			EditorGUILayout.BeginVertical();
			AddLine("手机", "像素长", "像素宽", "UI缩放长", "UI缩放宽", "UI可视长", "UI可视宽", "缩放");
			AddLine("iPhone4", 960, 640);
			AddLine("iPhone5", 1136, 640);
			AddLine("iPhone6", 1334, 750);
			AddLine("iPhone6 plus", 1920, 1080);
			AddLine("iPad mini", 1024, 768);
			AddLine("iPad air", 2048, 1536);
			
			AddLine("Android1", 1280, 720);
			AddLine("Android2", 1920, 1080);
			
			EditorGUILayout.EndVertical();
		}
    public override void OnInspectorGUI()
    {
        serializedObject.Update();
        NGUIEditorTools.SetLabelWidth(110f);

        SerializedProperty sp = NGUIEditorTools.DrawProperty("Scaling Style", serializedObject, "scalingStyle");

        UIRoot.Scaling scaling = (UIRoot.Scaling)sp.intValue;

        if (scaling == UIRoot.Scaling.Flexible)
        {
            NGUIEditorTools.DrawProperty("Minimum Height", serializedObject, "minimumHeight");
            NGUIEditorTools.DrawProperty("Maximum Height", serializedObject, "maximumHeight");
            NGUIEditorTools.DrawProperty("Shrink Portrait UI", serializedObject, "shrinkPortraitUI");
            NGUIEditorTools.DrawProperty("Adjust by DPI", serializedObject, "adjustByDPI");

            EditorGUILayout.HelpBox("Also known as the 'Pixel-Perfect' mode, this setting makes NGUI's virtual pixels match the screen. This means that your UI will look smaller on high resolution devices and bigger on lower resolution devices, but it will always be as crisp as it can be." +
                                    "\n\nIdeal usage: PC games with a modular user interface that takes advantage of widget anchoring.", MessageType.Info);
        }
        else
        {
            GUILayout.BeginHorizontal();
            NGUIEditorTools.DrawProperty("Content Width", serializedObject, "manualWidth", GUILayout.Width(160f));
            NGUIEditorTools.SetLabelWidth(26f);
            bool fitWidth = NGUIEditorTools.DrawProperty("Fit", serializedObject, "fitWidth").boolValue;
            NGUIEditorTools.SetLabelWidth(110f);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            NGUIEditorTools.DrawProperty("Content Height", serializedObject, "manualHeight", GUILayout.Width(160f));
            NGUIEditorTools.SetLabelWidth(26f);
            bool fitHeight = NGUIEditorTools.DrawProperty("Fit", serializedObject, "fitHeight").boolValue;
            NGUIEditorTools.SetLabelWidth(110f);
            GUILayout.EndHorizontal();

            if (fitHeight)
            {
                if (fitWidth)
                {
                    EditorGUILayout.HelpBox("Whatever you create within the content frame (blue outline) will always be visible, regardless of the screen's aspect ratio." +
                                            "\n\nThink of it as choosing the 'Fit' desktop background style.", MessageType.Info);
                }
                else
                {
                    EditorGUILayout.HelpBox("This setting will keep your UI look the same on all screen sizes relative to the height of the screen." +
                                            "\n\nYou will still be able to see more or less on the left and right sides of the screen as the aspect ratio changes.", MessageType.Info);
                }
            }
            else if (fitWidth)
            {
                EditorGUILayout.HelpBox("This setting will keep your UI look the same on all screen sizes relative to the width of the screen." +
                                        "\n\nYou will still be able to see more or less on the top and bottom sides sides of the screen as the aspect ratio changes.", MessageType.Info);
            }
            else
            {
                EditorGUILayout.HelpBox("Your UI within the content frame (blue outline) will always fill the screen, and edges will be cropped based on the aspect ratio." +
                                        "\n\nThink of it as choosing the 'Fill' desktop background style.", MessageType.Info);
            }
        }

        serializedObject.ApplyModifiedProperties();
    }
        protected override JSONObject ExportResource(ExportPreset preset)
        {
            WXHierarchyContext hierarchyContext = new WXHierarchyContext(preset, prefabPath);

            hierarchyContext.is2d         = true;
            hierarchyContext.prefab2dType = typeof(WXNGUITree);

            // 初始化输出的JSON对象
            JSONObject prefabJSONObject = new JSONObject(JSONObject.Type.OBJECT);

            JSONObject metaJson = new JSONObject(JSONObject.Type.OBJECT);

            prefabJSONObject.AddField("meta", metaJson);


            // 填充meta
            metaJson.AddField("name", exportName);
            metaJson.AddField("type", "2D");

            if (exportAsScene)
            {
                JSONObject configJson = new JSONObject(JSONObject.Type.OBJECT);
                metaJson.AddField("config", configJson);

                JSONObject resolutionJson = new JSONObject(JSONObject.Type.ARRAY);

                UIRoot uiRoot = getUIRoot(prefabRoot);
                if (uiRoot != null)
                {
                    Debug.Log("uiRoot is");
                    // var a = JsonUtility.ToJson(uiRoot, true);
                    // Debug.Log(a);
                    // Debug.Log(uiRoot.activeHeight);
                    // Debug.Log(uiRoot.manualWidth);
                    // Debug.Log(uiRoot.manualHeight);

                    UIRoot.Scaling scalingStyle = uiRoot.scalingStyle;
                    configJson.AddField("scalingStyle", (int)scalingStyle);
                    configJson.AddField("manualWidth", uiRoot.manualWidth);
                    configJson.AddField("manualHeight", uiRoot.manualHeight);
                    configJson.AddField("minimumHeight", uiRoot.minimumHeight);
                    configJson.AddField("maximumHeight", uiRoot.maximumHeight);
                    configJson.AddField("fitWidth", uiRoot.fitWidth);
                    configJson.AddField("fitHeight", uiRoot.fitHeight);
                    configJson.AddField("adjustByDPI", uiRoot.adjustByDPI);
                    configJson.AddField("shrinkPortraitUI", uiRoot.shrinkPortraitUI);

                    if (scalingStyle == UIRoot.Scaling.Flexible)
                    {
                        // 目前引擎没有对Flexible这种情况的支持,所以默认先导出一个假定的resolution
                        resolutionJson.Add(uiRoot.activeHeight);
                        resolutionJson.Add(uiRoot.activeHeight);
                    }
                    else
                    {
                        resolutionJson.Add(uiRoot.manualWidth);
                        resolutionJson.Add(uiRoot.manualHeight);
                    }
                }
                else
                {
                    // 无root情况,使用默认大小
                    resolutionJson.Add(1280);
                    resolutionJson.Add(720);
                }

                configJson.AddField("resolution", resolutionJson);
            }

            // 开始遍历
            WXEntity rootEntity = hierarchyContext.IterateGameObject(prefabRoot);

            prefabJSONObject.AddField("gameObjectList", hierarchyContext.GetGameObjectListJSON());
            prefabJSONObject.AddField("componentList", hierarchyContext.GetComponentListJSON());

            JSONObject editorInfo = new JSONObject(JSONObject.Type.OBJECT);

            editorInfo.AddField("assetVersion", 2);
            prefabJSONObject.AddField("editorInfo", editorInfo);
            //Debug.Log("Export Prefab " + prefabPath + "  " + hierarchyContext.resourceList.Count);

            foreach (string resource in hierarchyContext.resourceList)
            {
                AddDependencies(resource);
            }

            return(prefabJSONObject);
        }