@@ -78,6 +78,41 @@ public static Texture2D[] autoTransforms
7878 }
7979 }
8080
81+ private static class Styles
82+ {
83+ public static readonly GUIContent defaultSprite = EditorGUIUtility . TrTextContent ( "Default Sprite"
84+ , "The default Sprite set when creating a new Rule." ) ;
85+ public static readonly GUIContent defaultGameObject = EditorGUIUtility . TrTextContent ( "Default GameObject"
86+ , "The default GameObject set when creating a new Rule." ) ;
87+ public static readonly GUIContent defaultCollider = EditorGUIUtility . TrTextContent ( "Default Collider"
88+ , "The default Collider Type set when creating a new Rule." ) ;
89+
90+ public static readonly GUIContent extendNeighbor = EditorGUIUtility . TrTextContent ( "Extend Neighbor"
91+ , "Enabling this allows you to increase the range of neighbors beyond the 3x3 box." ) ;
92+
93+ public static readonly GUIContent tilingRules = EditorGUIUtility . TrTextContent ( "Tiling Rules" ) ;
94+ public static readonly GUIContent tilingRulesGameObject = EditorGUIUtility . TrTextContent ( "GameObject"
95+ , "The GameObject for the Tile which fits this Rule." ) ;
96+ public static readonly GUIContent tilingRulesCollider = EditorGUIUtility . TrTextContent ( "Collider"
97+ , "The Collider Type for the Tile which fits this Rule" ) ;
98+ public static readonly GUIContent tilingRulesOutput = EditorGUIUtility . TrTextContent ( "Output"
99+ , "The Output for the Tile which fits this Rule. Each Output type has its own properties." ) ;
100+
101+ public static readonly GUIContent tilingRulesNoise = EditorGUIUtility . TrTextContent ( "Noise"
102+ , "The Perlin noise factor when placing the Tile." ) ;
103+ public static readonly GUIContent tilingRulesShuffle = EditorGUIUtility . TrTextContent ( "Shuffle"
104+ , "The randomized transform given to the Tile when placing it." ) ;
105+ public static readonly GUIContent tilingRulesRandomSize = EditorGUIUtility . TrTextContent ( "Size"
106+ , "The number of Sprites to randomize from." ) ;
107+
108+ public static readonly GUIContent tilingRulesMinSpeed = EditorGUIUtility . TrTextContent ( "Min Speed"
109+ , "The minimum speed at which the animation is played." ) ;
110+ public static readonly GUIContent tilingRulesMaxSpeed = EditorGUIUtility . TrTextContent ( "Max Speed"
111+ , "The maximum speed at which the animation is played." ) ;
112+ public static readonly GUIContent tilingRulesAnimationSize = EditorGUIUtility . TrTextContent ( "Size"
113+ , "The number of Sprites in the animation." ) ;
114+ }
115+
81116 /// <summary>
82117 /// The RuleTile being edited
83118 /// </summary>
@@ -115,11 +150,11 @@ public static Texture2D[] autoTransforms
115150 /// <summary>
116151 /// Padding between Rule Elements
117152 /// </summary>
118- public const float k_PaddingBetweenRules = 26f ;
153+ public const float k_PaddingBetweenRules = 8f ;
119154 /// <summary>
120155 /// Single line height
121156 /// </summary>
122- public const float k_SingleLineHeight = 16f ;
157+ public const float k_SingleLineHeight = 18f ;
123158 /// <summary>
124159 /// Width for labels
125160 /// </summary>
@@ -216,10 +251,8 @@ public float GetElementHeight(RuleTile.TilingRuleOutput rule)
216251 switch ( rule . m_Output )
217252 {
218253 case RuleTile . TilingRule . OutputSprite . Random :
219- inspectorHeight = k_DefaultElementHeight + k_SingleLineHeight * ( rule . m_Sprites . Length + 3 ) + k_PaddingBetweenRules ;
220- break ;
221254 case RuleTile . TilingRule . OutputSprite . Animation :
222- inspectorHeight = k_DefaultElementHeight + k_SingleLineHeight * ( rule . m_Sprites . Length + 2 ) + k_PaddingBetweenRules ;
255+ inspectorHeight = k_DefaultElementHeight + k_SingleLineHeight * ( rule . m_Sprites . Length + 3 ) + k_PaddingBetweenRules ;
223256 break ;
224257 }
225258
@@ -359,14 +392,14 @@ public static List<RuleOverrideTile> FindAffectedOverrideTiles(RuleTile target)
359392 /// <param name="rect">GUI Rect to draw the header at</param>
360393 public void OnDrawHeader ( Rect rect )
361394 {
362- GUI . Label ( rect , "Tiling Rules" ) ;
395+ GUI . Label ( rect , Styles . tilingRules ) ;
363396
364397 Rect toggleRect = new Rect ( rect . xMax - rect . height , rect . y , rect . height , rect . height ) ;
365398 Rect toggleLabelRect = new Rect ( rect . x , rect . y , rect . width - toggleRect . width - 5f , rect . height ) ;
366399
367400 EditorGUI . BeginChangeCheck ( ) ;
368401 extendNeighbor = EditorGUI . Toggle ( toggleRect , extendNeighbor ) ;
369- EditorGUI . LabelField ( toggleLabelRect , "Extend Neighbor" , new GUIStyle ( )
402+ EditorGUI . LabelField ( toggleLabelRect , Styles . extendNeighbor , new GUIStyle ( )
370403 {
371404 alignment = TextAnchor . MiddleRight ,
372405 fontStyle = FontStyle . Bold ,
@@ -392,9 +425,9 @@ public override void OnInspectorGUI()
392425 {
393426 EditorGUI . BeginChangeCheck ( ) ;
394427
395- tile . m_DefaultSprite = EditorGUILayout . ObjectField ( "Default Sprite" , tile . m_DefaultSprite , typeof ( Sprite ) , false ) as Sprite ;
396- tile . m_DefaultGameObject = EditorGUILayout . ObjectField ( "Default GameObject" , tile . m_DefaultGameObject , typeof ( GameObject ) , false ) as GameObject ;
397- tile . m_DefaultColliderType = ( Tile . ColliderType ) EditorGUILayout . EnumPopup ( "Default Collider" , tile . m_DefaultColliderType ) ;
428+ tile . m_DefaultSprite = EditorGUILayout . ObjectField ( Styles . defaultSprite , tile . m_DefaultSprite , typeof ( Sprite ) , false ) as Sprite ;
429+ tile . m_DefaultGameObject = EditorGUILayout . ObjectField ( Styles . defaultGameObject , tile . m_DefaultGameObject , typeof ( GameObject ) , false ) as GameObject ;
430+ tile . m_DefaultColliderType = ( Tile . ColliderType ) EditorGUILayout . EnumPopup ( Styles . defaultCollider , tile . m_DefaultColliderType ) ;
398431
399432 DrawCustomFields ( false ) ;
400433
@@ -701,39 +734,40 @@ public virtual void SpriteOnGUI(Rect rect, RuleTile.TilingRuleOutput tilingRule)
701734 public void RuleInspectorOnGUI ( Rect rect , RuleTile . TilingRuleOutput tilingRule )
702735 {
703736 float y = rect . yMin ;
704- GUI . Label ( new Rect ( rect . xMin , y , k_LabelWidth , k_SingleLineHeight ) , "GameObject" ) ;
737+ GUI . Label ( new Rect ( rect . xMin , y , k_LabelWidth , k_SingleLineHeight ) , Styles . tilingRulesGameObject ) ;
705738 tilingRule . m_GameObject = ( GameObject ) EditorGUI . ObjectField ( new Rect ( rect . xMin + k_LabelWidth , y , rect . width - k_LabelWidth , k_SingleLineHeight ) , "" , tilingRule . m_GameObject , typeof ( GameObject ) , false ) ;
706739 y += k_SingleLineHeight ;
707- GUI . Label ( new Rect ( rect . xMin , y , k_LabelWidth , k_SingleLineHeight ) , "Collider" ) ;
740+ GUI . Label ( new Rect ( rect . xMin , y , k_LabelWidth , k_SingleLineHeight ) , Styles . tilingRulesCollider ) ;
708741 tilingRule . m_ColliderType = ( Tile . ColliderType ) EditorGUI . EnumPopup ( new Rect ( rect . xMin + k_LabelWidth , y , rect . width - k_LabelWidth , k_SingleLineHeight ) , tilingRule . m_ColliderType ) ;
709742 y += k_SingleLineHeight ;
710- GUI . Label ( new Rect ( rect . xMin , y , k_LabelWidth , k_SingleLineHeight ) , "Output" ) ;
743+ GUI . Label ( new Rect ( rect . xMin , y , k_LabelWidth , k_SingleLineHeight ) , Styles . tilingRulesOutput ) ;
711744 tilingRule . m_Output = ( RuleTile . TilingRule . OutputSprite ) EditorGUI . EnumPopup ( new Rect ( rect . xMin + k_LabelWidth , y , rect . width - k_LabelWidth , k_SingleLineHeight ) , tilingRule . m_Output ) ;
712745 y += k_SingleLineHeight ;
713746
714747 if ( tilingRule . m_Output == RuleTile . TilingRule . OutputSprite . Animation )
715748 {
716- GUI . Label ( new Rect ( rect . xMin , y , k_LabelWidth , k_SingleLineHeight ) , "Min Speed" ) ;
749+ GUI . Label ( new Rect ( rect . xMin , y , k_LabelWidth , k_SingleLineHeight ) , Styles . tilingRulesMinSpeed ) ;
717750 tilingRule . m_MinAnimationSpeed = EditorGUI . FloatField ( new Rect ( rect . xMin + k_LabelWidth , y , rect . width - k_LabelWidth , k_SingleLineHeight ) , tilingRule . m_MinAnimationSpeed ) ;
718751 y += k_SingleLineHeight ;
719- GUI . Label ( new Rect ( rect . xMin , y , k_LabelWidth , k_SingleLineHeight ) , "Max Speed" ) ;
752+ GUI . Label ( new Rect ( rect . xMin , y , k_LabelWidth , k_SingleLineHeight ) , Styles . tilingRulesMaxSpeed ) ;
720753 tilingRule . m_MaxAnimationSpeed = EditorGUI . FloatField ( new Rect ( rect . xMin + k_LabelWidth , y , rect . width - k_LabelWidth , k_SingleLineHeight ) , tilingRule . m_MaxAnimationSpeed ) ;
721754 y += k_SingleLineHeight ;
722755 }
723756 if ( tilingRule . m_Output == RuleTile . TilingRule . OutputSprite . Random )
724757 {
725- GUI . Label ( new Rect ( rect . xMin , y , k_LabelWidth , k_SingleLineHeight ) , "Noise" ) ;
758+ GUI . Label ( new Rect ( rect . xMin , y , k_LabelWidth , k_SingleLineHeight ) , Styles . tilingRulesNoise ) ;
726759 tilingRule . m_PerlinScale = EditorGUI . Slider ( new Rect ( rect . xMin + k_LabelWidth , y , rect . width - k_LabelWidth , k_SingleLineHeight ) , tilingRule . m_PerlinScale , 0.001f , 0.999f ) ;
727760 y += k_SingleLineHeight ;
728761
729- GUI . Label ( new Rect ( rect . xMin , y , k_LabelWidth , k_SingleLineHeight ) , "Shuffle" ) ;
762+ GUI . Label ( new Rect ( rect . xMin , y , k_LabelWidth , k_SingleLineHeight ) , Styles . tilingRulesShuffle ) ;
730763 tilingRule . m_RandomTransform = ( RuleTile . TilingRule . Transform ) EditorGUI . EnumPopup ( new Rect ( rect . xMin + k_LabelWidth , y , rect . width - k_LabelWidth , k_SingleLineHeight ) , tilingRule . m_RandomTransform ) ;
731764 y += k_SingleLineHeight ;
732765 }
733766
734767 if ( tilingRule . m_Output != RuleTile . TilingRule . OutputSprite . Single )
735768 {
736- GUI . Label ( new Rect ( rect . xMin , y , k_LabelWidth , k_SingleLineHeight ) , "Size" ) ;
769+ GUI . Label ( new Rect ( rect . xMin , y , k_LabelWidth , k_SingleLineHeight )
770+ , tilingRule . m_Output == RuleTile . TilingRuleOutput . OutputSprite . Animation ? Styles . tilingRulesAnimationSize : Styles . tilingRulesRandomSize ) ;
737771 EditorGUI . BeginChangeCheck ( ) ;
738772 int newLength = EditorGUI . DelayedIntField ( new Rect ( rect . xMin + k_LabelWidth , y , rect . width - k_LabelWidth , k_SingleLineHeight ) , tilingRule . m_Sprites . Length ) ;
739773 if ( EditorGUI . EndChangeCheck ( ) )
0 commit comments