Skip to content

Commit

Permalink
added UISpacer object to space out containers
Browse files Browse the repository at this point in the history
  • Loading branch information
prime31 committed May 14, 2012
1 parent b75d3a2 commit f76951f
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 1 deletion.
Expand Up @@ -42,7 +42,6 @@ void Start()
{
touchable = UIButton.create( "optionsUp.png", "optionsDown.png", 0, 0 );
}


if( i == 1 )
{
Expand Down Expand Up @@ -78,6 +77,9 @@ void Start()
button.onTouchUpInside += ( sender ) => Debug.Log( "touched button: " + j );
}

// add random spacers every so often
if( i % 3 == 0 )
scrollable.addChild( new UISpacer( Random.Range( 10, 100 ), 40 ) );

scrollable.addChild( touchable );
}
Expand All @@ -104,6 +106,7 @@ void Start()
var button = UIButton.create( "marioPanel.png", "marioPanel.png", 0, 0 );
scrollable.addChild( button );
}

scrollable.endUpdates();
scrollable.endUpdates(); // this is a bug. it shouldnt need to be called twice
}
Expand Down
Expand Up @@ -463,6 +463,7 @@ public void setSize( float width, float height )
calculateMinMaxInsets();
}


/// <summary>
/// Clear all childs
/// </summary>
Expand All @@ -471,6 +472,7 @@ public void setSize( float width, float height )
layoutChildren();
}


/// <summary>
/// Override so that we can remove the touchable sprites. The container needs to manage all touches.
/// </summary>
Expand Down
3 changes: 3 additions & 0 deletions Assets/Plugins/UIToolkit/BaseElements/UISprite.cs
Expand Up @@ -38,6 +38,9 @@ public class UISprite : UIObject, IPositionable
protected Dictionary<string, UISpriteAnimation> spriteAnimations;


public UISprite(){}


public UISprite( Rect frame, int depth, UIUVRect uvFrame ) : this( frame, depth, uvFrame, false )
{}

Expand Down
26 changes: 26 additions & 0 deletions Assets/Plugins/UIToolkit/UIElements/UISpacer.cs
@@ -0,0 +1,26 @@
using UnityEngine;
using System.Collections;



public class UISpacer : UISprite
{
public override bool hidden
{
get { return ___hidden; }
set {}
}


public override void updateTransform()
{}


public UISpacer( int width, int height )
{
manager = UI.firstToolkit;

_width = width;
_height = height;
}
}
7 changes: 7 additions & 0 deletions Assets/Plugins/UIToolkit/UIElements/UISpacer.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f76951f

Please sign in to comment.