public override void OnInspectorGUI()
 {
     base.OnInspectorGUI();
     if (GUILayout.Button("Edit In Window"))
     {
         InspectorInWindow.ShowInspector(target);
     }
 }
        public override void OnInspectorGUI()
        {
            if (_target == null)
            {
                _target = (UIPage)target;
            }
            if (_target_seriablizedObj == null)
            {
                _target_seriablizedObj = new SerializedObject(_target);
            }
            EditorGUILayout.BeginVertical();

            //处理者
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(new GUIContent(I18Ns.UIHandler, I18Ns.UIHandler_Tooltips), GUILayout.MaxWidth(100));
            if (_mainUIHandler == null && _target_seriablizedObj != null)
            {
                _mainUIHandler = _target_seriablizedObj.FindProperty("UIMainHandler");
            }
            EditorGUILayout.PropertyField(_mainUIHandler, GUIContent.none);
            //_target.UIMainHandler = EditorGUILayout.ObjectField(_target.UIMainHandler, typeof(UnityEngine.MonoBehaviour), true);
            EditorGUILayout.EndHorizontal();

            //处理者的奇怪判断
            if (_mainUIHandler.objectReferenceValue == null)
            {
                var xc = _target.gameObject.GetComponent <XComponentScriptBase>();
                if (xc != null)
                {
                    if (GUILayout.Button(string.Format(I18Ns.Btn_SetHandler, xc.GetType().Name)))
                    {
                        _mainUIHandler.objectReferenceValue = xc;
                    }
                }
            }
            else
            {
                if (!_mainUIHandler.objectReferenceValue.GetType().IsSubclassOf(typeof(MonoBehaviour)))
                {
                    //无效警告
                    EditorGUILayout.LabelField(I18Ns.UIHandlerInvalid, Styles.label_warning);
                }
            }

            //全屏
            GUILayout.Space(10);
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(new GUIContent(I18Ns.FullScreenUI, I18Ns.FullScreenUI_ToolTips), GUILayout.MaxWidth(100));
            if (_fullScreenUI == null && _target_seriablizedObj != null)
            {
                _fullScreenUI = _target_seriablizedObj.FindProperty("FullScreenUI");
            }
            EditorGUILayout.PropertyField(_fullScreenUI, GUIContent.none);
            //_target.FullScreenUI = EditorGUILayout.Toggle(_target.FullScreenUI);
            EditorGUILayout.EndHorizontal();

            //Screen UI
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Screen UI", GUILayout.MaxWidth(100));
            if (_screenUI == null && _target_seriablizedObj != null)
            {
                _screenUI = _target_seriablizedObj.FindProperty("ScreenUI");
            }
            EditorGUILayout.PropertyField(_screenUI, GUIContent.none);

            //_target.ScreenUI = EditorGUILayout.Toggle(_target.ScreenUI);
            EditorGUILayout.EndHorizontal();

            //多开
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(new GUIContent(I18Ns.MultipleUI, I18Ns.MultipleUI_Tooltips), GUILayout.MaxWidth(100));
            if (_allowMultiple == null && _target_seriablizedObj != null)
            {
                _allowMultiple = _target_seriablizedObj.FindProperty("AllowMultiple");
            }
            EditorGUILayout.PropertyField(_allowMultiple, GUIContent.none);
            //_target.AllowMultiple = EditorGUILayout.Toggle(_target.AllowMultiple);
            EditorGUILayout.EndHorizontal();

            //SortingLayer
            GUILayout.Space(10);
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("SortingLayer", GUILayout.MaxWidth(100));
            if (_sortingLayer == null && _target_seriablizedObj != null)
            {
                _sortingLayer = _target_seriablizedObj.FindProperty("SortingLayerId");
            }

            //int sorting_layer_value = 0;


            //if (SortingLayer.layers.Any(sl => sl.value == _sortingLayer.intValue))
            //    sorting_layer_value = _sortingLayer.intValue;
            //var sorting_layers = SortingLayer.layers;
            //var sorting_layer_names = sorting_layers.Select(s => s.name).ToArray();
            //sorting_layer_value = EditorGUILayout.Popup(sorting_layer_value, sorting_layer_names);
            //_sortingLayer.intValue = sorting_layer_value;

            var sorting_layers      = SortingLayer.layers;
            var sorting_layer_ids   = sorting_layers.Select(sl => sl.id).ToArray();
            var sorting_layer_names = sorting_layers.Select(sl => sl.name).ToArray();

            int sorting_layer_select_index = 0;

            for (var i = 0; i < sorting_layer_ids.Length; i++)
            {
                if (sorting_layer_ids[i] == _sortingLayer.intValue)
                {
                    sorting_layer_select_index = i;
                    break;
                }
            }
            sorting_layer_select_index = EditorGUILayout.Popup(sorting_layer_select_index, sorting_layer_names);
            _sortingLayer.intValue     = sorting_layer_ids[sorting_layer_select_index];



            EditorGUILayout.EndHorizontal();

            //动画-----------------------------------------------------------------------
            GUILayout.Space(10);
            EditorGUILayout.LabelField("UI Animation", EditorStyles.largeLabel);
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(new GUIContent(I18Ns.UIShow_Ani), GUILayout.MaxWidth(120));
            if (_uiShowAni == null && _target_seriablizedObj != null)
            {
                _uiShowAni = _target_seriablizedObj.FindProperty("UIShowAni");
            }
            EditorGUILayout.PropertyField(_uiShowAni, GUIContent.none);

            //_target.UIShowAni = (UIAnimationBase)EditorGUILayout.ObjectField(_target.UIShowAni,typeof(UIAnimationBase),true);
            EditorGUILayout.EndHorizontal();
            if (_uiShowAni.objectReferenceValue != null)
            {
                ((UIAnimationBase)_uiShowAni.objectReferenceValue).playOnAwake = false;
            }

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(new GUIContent(I18Ns.UIExit_Ani), GUILayout.MaxWidth(120));
            if (_uiExitAni == null && _target_seriablizedObj != null)
            {
                _uiExitAni = _target_seriablizedObj.FindProperty("UIExitAni");
            }
            EditorGUILayout.PropertyField(_uiExitAni, GUIContent.none);
            //_target.UIExitAni = (UIAnimationBase)EditorGUILayout.ObjectField(_target.UIExitAni, typeof(UIAnimationBase), true);
            EditorGUILayout.EndHorizontal();
            if (_uiExitAni.objectReferenceValue != null)
            {
                ((UIAnimationBase)_uiExitAni.objectReferenceValue).pingPong = false;
            }
            //if (_target.UIExitAni != null)
            //    _target.UIExitAni.pingPong = false;

            //音效


            if (GUILayout.Button("Edit In Window"))
            {
                InspectorInWindow.ShowInspector(target);
            }
            EditorGUILayout.EndVertical();

            if (_target_seriablizedObj != null)
            {
                _target_seriablizedObj.ApplyModifiedProperties();
            }
        }
        public override void OnInspectorGUI()
        {
            if (_target == null)
            {
                _target = (UIPage)target;
            }
            EditorGUILayout.BeginVertical();

            //处理者
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(new GUIContent(I18Ns.UIHandler, I18Ns.UIHandler_Tooltips), GUILayout.MaxWidth(100));
            _target.UIMainHandler = EditorGUILayout.ObjectField(_target.UIMainHandler, typeof(UnityEngine.MonoBehaviour), true);
            EditorGUILayout.EndHorizontal();

            //处理者的奇怪判断
            if (_target.UIMainHandler == null)
            {
                var xc = _target.gameObject.GetComponent <XComponentScriptBase>();
                if (xc != null)
                {
                    if (GUILayout.Button(string.Format(I18Ns.Btn_SetHandler, xc.GetType().Name)))
                    {
                        _target.UIMainHandler = xc;
                    }
                }
            }
            else
            {
                if (!_target.UIMainHandler.GetType().IsSubclassOf(typeof(MonoBehaviour)))
                {
                    //无效警告
                    EditorGUILayout.LabelField(I18Ns.UIHandlerInvalid, Styles.label_warning);
                }
            }

            //全屏
            GUILayout.Space(10);
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(new GUIContent(I18Ns.FullScreenUI, I18Ns.FullScreenUI_ToolTips), GUILayout.MaxWidth(100));
            _target.FullScreenUI = EditorGUILayout.Toggle(_target.FullScreenUI);
            EditorGUILayout.EndHorizontal();

            //Screen UI
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Screen UI", GUILayout.MaxWidth(100));
            _target.ScreenUI = EditorGUILayout.Toggle(_target.ScreenUI);
            EditorGUILayout.EndHorizontal();

            //多开
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(new GUIContent(I18Ns.MultipleUI, I18Ns.MultipleUI_Tooltips), GUILayout.MaxWidth(100));
            _target.AllowMultiple = EditorGUILayout.Toggle(_target.AllowMultiple);
            EditorGUILayout.EndHorizontal();

            //SortingLayer
            GUILayout.Space(10);
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("SortingLayer", GUILayout.MaxWidth(100));
            int sorting_layer_id = 0;

            if (SortingLayer.IsValid(_target.SortingLayerID))
            {
                sorting_layer_id = _target.SortingLayerID;
            }
            var sorting_layers      = SortingLayer.layers;
            var sorting_layer_names = sorting_layers.Select(s => s.name).ToArray();

            sorting_layer_id = EditorGUILayout.Popup(sorting_layer_id, sorting_layer_names);
            EditorGUILayout.EndHorizontal();

            //动画-----------------------------------------------------------------------
            GUILayout.Space(10);
            EditorGUILayout.LabelField("UI Animation", EditorStyles.largeLabel);
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(new GUIContent(I18Ns.UIShow_Ani), GUILayout.MaxWidth(120));
            _target.UIShowAni = (UIAnimationBase)EditorGUILayout.ObjectField(_target.UIShowAni, typeof(UIAnimationBase), true);
            EditorGUILayout.EndHorizontal();
            if (_target.UIShowAni != null)
            {
                _target.UIShowAni.playOnAwake = false;
            }

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(new GUIContent(I18Ns.UIExit_Ani), GUILayout.MaxWidth(120));
            _target.UIExitAni = (UIAnimationBase)EditorGUILayout.ObjectField(_target.UIExitAni, typeof(UIAnimationBase), true);
            EditorGUILayout.EndHorizontal();
            if (_target.UIExitAni != null)
            {
                _target.UIExitAni.pingPong = false;
            }

            //音效


            if (GUILayout.Button("Edit In Window"))
            {
                InspectorInWindow.ShowInspector(target);
            }
            EditorGUILayout.EndVertical();
        }