Beispiel #1
0
        /// <summary>
        /// Draw the atlas and Image selection fields.
        /// </summary>

        protected void SpriteGUI()
        {
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.BeginHorizontal();
            //图集
            if (SUGUIEditorTool.DrawPrefixButton("Atlas"))
            {
                AtlasSelector.ShowWind(SelectAtlas);
            }
            SUGUIEditorTool.DrawObjectField <SpriteAtlas>(m_SpriteAtlas, "");
            EditorGUILayout.EndHorizontal();

            SUGUIEditorTool.DrawAtlasSpriteField(m_SpriteAtlas.objectReferenceValue as SpriteAtlas,
                                                 m_SpriteName.stringValue, SelectSprite);
            if (EditorGUI.EndChangeCheck())
            {
                var newSprite = m_Sprite.objectReferenceValue as Sprite;
                if (newSprite)
                {
                    Image.Type oldType = (Image.Type)m_Type.enumValueIndex;
                    if (newSprite.border.SqrMagnitude() > 0)
                    {
                        m_Type.enumValueIndex = (int)Image.Type.Sliced;
                    }
                    else if (oldType == Image.Type.Sliced)
                    {
                        m_Type.enumValueIndex = (int)Image.Type.Simple;
                    }
                }
                (serializedObject.targetObject as Image).DisableSpriteOptimizations();
            }
        }
Beispiel #2
0
 //TextStyle
 public virtual void DrawTextStyle()
 {
     SUGUIEditorTool.DrawObjectField <TextStyle>(m_Style, "Text Style");
     if (m_Style.objectReferenceValue == null)
     {
         ((SText)target).textStyle = SUGUISetting.textStyle;
     }
 }