private void OnGUI()
        {
            DrawLocalizationSelect();

            EditorGUILayout.Space();
            EditorGUILayoutUtil.DrawUILine(Color.white, width: position.size.x);
            EditorGUILayout.Space();

            _drawCheckHelper();

            EditorGUILayout.Space();
            EditorGUILayoutUtil.DrawUILine(Color.white, width: position.size.x);
            EditorGUILayout.Space();

            _drawToggle(ToRectKey);
            _drawToggle(IncludeInactive);
        }
示例#2
0
        private void OnGUI()
        {
            DrawLocalizationSelect();

            EditorGUILayout.Space();
            EditorGUILayoutUtil.DrawUILine(Color.cyan, width: position.width);
            EditorGUILayout.Space();

            EditorGUILayout.BeginHorizontal();
            {
                EditorGUILayout.LabelField(_selectDefaultMaterialLabel);

                _material = (Material)EditorGUILayout.ObjectField(_material, typeof(Material), false);
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            {
                EditorGUILayout.LabelField(_selectDefaultSpriteLabel);

                _sprite = (Sprite)EditorGUILayout.ObjectField(_sprite, typeof(Sprite), false);
            }
            EditorGUILayout.EndHorizontal();

            _isRayCastTarget = EditorGUILayout.ToggleLeft(_isRayCastTargetLabel, _isRayCastTarget);

            _isRich = EditorGUILayout.ToggleLeft(_isOpenRich, _isRich);

            _donotMaskToRMask = EditorGUILayout.ToggleLeft(_doNotMaskToRectMask, _donotMaskToRMask);

            _setDefaultMaterial(_material);
            _setDefaultSprite(_sprite);
            _setRayCastEnableState(_isRayCastTarget);
            _setRichEnableState(_isRich);
            Cfg.CSVEncrypting.SetValue(DoNotMaskToRectMask_Bool, _donotMaskToRMask);

//            if (GUILayout.Button("复制 Unity 默认 Sprite 到项目"))
//            {
//                string kKnobPath = "UI/Skin/Knob.psd";
//
//                //var path = EditorUtility.SaveFilePanel("Select Save Folder", Application.dataPath,"uiSprite", ".png");
//
//                var path = EditorUtility.OpenFolderPanel("s", Application.dataPath, "");
//
//                if (string.IsNullOrEmpty(path))
//                {
//                    Debug.LogError("取消了复制");
//                    return;
//                }

//                Object[] UnityAssets = AssetDatabase.LoadAllAssetsAtPath("Resources/unity_builtin_extra");
//                foreach (var asset in UnityAssets)
//                {
//                    path = path.Replace(Application.dataPath,"Assets/");
//                    if (asset is Texture2D)
//                    {
//                        AssetDatabase.CreateAsset(asset, Path.Combine(path, "uiSprite.asset"));
//                    }
//                }

            // var texture2D = AssetDatabase.GetBuiltinExtraResource<Texture2D>(kKnobPath);
//                var sp = Sprite.Create(texture2D, new Rect(0, 0, texture2D.width, texture2D.height),
//                    new Vector2(0.5f, 0.5f));
//
//                var bys = sp.texture.EncodeToPNG();
//
//                path = path.Replace(Application.dataPath,"Assets/");

            //var bys = CombineTextures(texture2D).EncodeToPNG();

            //File.WriteAllBytes(path,bys);

//                Graphics.CopyTexture(texture2D.);

//                AssetDatabase.CreateAsset(texture2D, Path.Combine(path, "uiSprite.png"));

//                AssetDatabase.Refresh();
//            }
        }