Exemple #1
0
        public override void OnInspectorGUI()
        {
            BetterImage img = target as BetterImage;


            base.serializedObject.Update();
            this.SpriteGUI();

            EditorGUILayout.Separator();
            if (img.type == Image.Type.Filled)
            {
                // coloring and materials not (yet) supported for filled images
                EditorGUILayout.PropertyField(this.m_Color);
                EditorGUILayout.PropertyField(this.m_Material);
            }
            else
            {
                // draw color and material
                materialDrawer.DrawInspectorGui(base.m_Material);
            }
            EditorGUILayout.Separator();


            base.RaycastControlsGUI();
            this.m_ShowType.target = this.m_Sprite.objectReferenceValue != null;
            if (EditorGUILayout.BeginFadeGroup(this.m_ShowType.faded))
            {
                this.TypeGUI();
            }
            EditorGUILayout.EndFadeGroup();
            this.SetShowNativeSize(false);
            if (EditorGUILayout.BeginFadeGroup(this.m_ShowNativeSize.faded))
            {
                EditorGUI.indentLevel = EditorGUI.indentLevel + 1;
                EditorGUILayout.PropertyField(this.m_PreserveAspect, new GUILayoutOption[0]);
                EditorGUI.indentLevel = EditorGUI.indentLevel - 1;
            }
            EditorGUILayout.EndFadeGroup();
            base.NativeSizeButtonGUI();
            base.serializedObject.ApplyModifiedProperties();



            if (img.type == UnityEngine.UI.Image.Type.Sliced)
            {
                var prop = serializedObject.FindProperty("keepBorderAspectRatio");
                EditorGUILayout.PropertyField(prop);
                serializedObject.ApplyModifiedProperties();
            }

            if (img.type == Image.Type.Sliced || img.type == Image.Type.Tiled)
            {
                var prop       = serializedObject.FindProperty("spriteBorderScaleFallback");
                var collection = serializedObject.FindProperty("customBorderScales");
                //EditorGUILayout.PropertyField(prop);

                ScreenConfigConnectionHelper.DrawSizerGui("Border Scale", collection, ref prop);
                serializedObject.ApplyModifiedProperties();
            }
        }
Exemple #2
0
        /// <summary>
        ///   <para>Implement specific RawImage inspector GUI code here. If you want to simply extend the existing editor call the base OnInspectorGUI () before doing any custom GUI code.</para>
        /// </summary>
        public override void OnInspectorGUI()
        {
            base.serializedObject.Update();
            EditorGUILayout.PropertyField(this.m_Texture, new GUILayoutOption[0]);
            //base.AppearanceControlsGUI();
            materialDrawer.DrawInspectorGui(base.m_Material);

            base.RaycastControlsGUI();
            EditorGUILayout.PropertyField(this.m_UVRect, this.m_UVRectContent, new GUILayoutOption[0]);
            this.SetShowNativeSize(false);
            base.NativeSizeButtonGUI();

            base.serializedObject.ApplyModifiedProperties();
        }