Exemplo n.º 1
0
	public static UIToggleButton create( UIToolkit manager, string filename, string selectedFilename, string highlightedFilename, int xPos, int yPos )
	{
		var textureInfo = manager.textureInfoForFilename( filename );
		var frame = new Rect( xPos, yPos, textureInfo.frame.width, textureInfo.frame.height );
		
		var selectedTI = manager.textureInfoForFilename( selectedFilename );
		var highlightedTI = manager.textureInfoForFilename( highlightedFilename );
		
		return new UIToggleButton( manager, frame, 1, textureInfo.uvRect, selectedTI.uvRect, highlightedTI.uvRect );
	}
Exemplo n.º 2
0
    public static UIToggleButton create(UIToolkit manager, string filename, string selectedFilename, string highlightedFilename, int xPos, int yPos, int depth)
    {
        var textureInfo = manager.textureInfoForFilename(filename);
        var frame       = new Rect(xPos, yPos, textureInfo.frame.width, textureInfo.frame.height);

        var selectedTI    = manager.textureInfoForFilename(selectedFilename);
        var highlightedTI = manager.textureInfoForFilename(highlightedFilename);

        return(new UIToggleButton(manager, frame, depth, textureInfo.uvRect, selectedTI.uvRect, highlightedTI.uvRect));
    }
Exemplo n.º 3
0
    public static new UIContinuousButton create(UIToolkit manager, string filename, string highlightedFilename, int xPos, int yPos, int depth)
    {
        // grab the texture details for the normal state
        var normalTI = manager.textureInfoForFilename(filename);
        var frame    = new Rect(xPos, yPos, normalTI.frame.width, normalTI.frame.height);

        // get the highlighted state
        var highlightedTI = manager.textureInfoForFilename(highlightedFilename);

        // create the button
        return(new UIContinuousButton(manager, frame, depth, normalTI.uvRect, highlightedTI.uvRect));
    }
Exemplo n.º 4
0
    public static new UIContinuousButton create( UIToolkit manager, string filename, string highlightedFilename, int xPos, int yPos, int depth )
    {
        // grab the texture details for the normal state
        var normalTI = manager.textureInfoForFilename( filename );
        var frame = new Rect( xPos, yPos, normalTI.frame.width, normalTI.frame.height );

        // get the highlighted state
        var highlightedTI = manager.textureInfoForFilename( highlightedFilename );

        // create the button
        return new UIContinuousButton( manager, frame, depth, normalTI.uvRect, highlightedTI.uvRect );
    }
Exemplo n.º 5
0
    /// <summary>
    /// Create a Slice-9 touchable sprite
    /// </summary>
    /// <param name='manager'>
    /// Manager.
    /// </param>
    /// <param name='filename'>
    /// Filename.
    /// </param>
    /// <param name='highlightedFilename'>
    /// Highlighted filename.
    /// </param>
    /// <param name='xPos'>
    /// X position.
    /// </param>
    /// <param name='yPos'>
    /// Y position.
    /// </param>
    /// <param name='width'>
    /// Width.
    /// </param>
    /// <param name='height'>
    /// Height.
    /// </param>
    /// <param name='sTP'>
    /// Top Margin
    /// </param>
    /// <param name='sRT'>
    /// Right Margin
    /// </param>
    /// <param name='sBT'>
    /// Bottom Margin
    /// </param>
    /// <param name='sLT'>
    /// Left Margin
    /// </param>
    public static UISlice9 create(UIToolkit manager, string filename, string highlightedFilename, int xPos, int yPos, int width, int height, int sTP, int sRT, int sBT, int sLT, int depth)
    {
        // grab the texture details for the normal state
        var normalTI = manager.textureInfoForFilename(filename);
        var frame    = new Rect(xPos, yPos, normalTI.frame.width, normalTI.frame.height);

        // get the highlighted state
        var highlightedTI = manager.textureInfoForFilename(highlightedFilename);

        // create the button
        return(new UISlice9(manager, frame, depth, normalTI.uvRect, highlightedTI.uvRect, width, height, sTP, sRT, sBT, sLT));
    }
Exemplo n.º 6
0
    public static UITextButton create(UIToolkit manager, string filename, string highlightedFilename, int xPos, int yPos, int depth)
    {
        if (manager == null)
        {
            manager = UIToolkit.instance;
        }

        // grab the texture details for the normal state
        var normalTI = manager.textureInfoForFilename(filename);
        var frame    = new Rect(xPos, yPos, normalTI.frame.width, normalTI.frame.height);

        // get the highlighted state
        var highlightedTI = manager.textureInfoForFilename(highlightedFilename);

        return(new UITextButton(manager, frame, depth, normalTI.uvRect, highlightedTI.uvRect));
    }
Exemplo n.º 7
0
    public static UITexture create( UIToolkit manager, string filename, int xPos, int yPos, int depth )
    {
        var normalTI = manager.textureInfoForFilename( filename );
        var frame = new Rect( xPos, yPos, normalTI.frame.width, normalTI.frame.height );

        return new UITexture( manager, frame, depth, normalTI.uvRect);
    }
	public UIVerticalPanel( UIToolkit manager, string topFilename, string middleFilename, string bottomFilename ) : base( UILayoutType.Vertical )
	{
		var texInfo = manager.textureInfoForFilename( topFilename );
		_topStrip = manager.addSprite( topFilename, 0, 0, 5 );
		_topStrip.parentUIObject = this;
		_topStripHeight = (int)texInfo.frame.height;
		_width = texInfo.frame.width;
		
		// we overlap the topStrip 1 pixel to ensure we get a good blend here
		_middleStrip = manager.addSprite( middleFilename, 0, _topStripHeight , 5 );
		_middleStrip.parentUIObject = this;
		
		texInfo = manager.textureInfoForFilename( middleFilename );
		_bottomStrip = manager.addSprite( bottomFilename, 0, 0, 5 );
		_bottomStrip.parentUIObject = this;
		_bottomStripHeight = (int)texInfo.frame.height;
	}
Exemplo n.º 9
0
    public UIVerticalPanel(UIToolkit manager, string topFilename, string middleFilename, string bottomFilename) : base(UILayoutType.Vertical)
    {
        var texInfo = manager.textureInfoForFilename(topFilename);

        _topStrip = manager.addSprite(topFilename, 0, 0, 5);
        _topStrip.parentUIObject = this;
        _topStripHeight          = (int)texInfo.frame.height;
        _width = texInfo.frame.width;

        // we overlap the topStrip 1 pixel to ensure we get a good blend here
        _middleStrip = manager.addSprite(middleFilename, 0, _topStripHeight, 5);
        _middleStrip.parentUIObject = this;

        texInfo      = manager.textureInfoForFilename(middleFilename);
        _bottomStrip = manager.addSprite(bottomFilename, 0, 0, 5);
        _bottomStrip.parentUIObject = this;
        _bottomStripHeight          = (int)texInfo.frame.height;
    }
Exemplo n.º 10
0
    // the bars x/y coordinates should be relative to the borders
    public static UIProgressBar create(UIToolkit manager, string barFilename, string borderFilename, int barxPos, int baryPos, int borderxPos, int borderyPos)
    {
        var bar = manager.addSprite(barFilename, borderxPos + barxPos, borderyPos + baryPos, 2);

        var borderTI    = manager.textureInfoForFilename(borderFilename);
        var borderFrame = new Rect(borderxPos, borderyPos, borderTI.size.x, borderTI.size.y);

        return(new UIProgressBar(manager, borderFrame, 1, borderTI.uvRect, bar));
    }
Exemplo n.º 11
0
	public static UIStateButton create( UIToolkit manager, string[] filenames, string[] highlightedFilenames, int xPos, int yPos, int depth )
	{
		
		// grab the texture details for the initial state
		var firstNormalTI = manager.textureInfoForFilename( filenames[0] );
		var frame = new Rect( xPos, yPos, firstNormalTI.frame.width, firstNormalTI.frame.height );

		// get the initial highlighted state
		var firstHighlightedTI = firstNormalTI;
		if (highlightedFilenames.Length > 0) {
			manager.textureInfoForFilename( highlightedFilenames[0] );
		}
		
		var button = new UIStateButton( manager, frame, depth, firstNormalTI.uvRect, firstHighlightedTI.uvRect );

		button.addFrames(filenames, highlightedFilenames);
		
		return button;
	}
Exemplo n.º 12
0
    public static UIColorPicker create( UIToolkit manager, string filename, int xPos, int yPos, int depth )
    {
        // grab the texture details for the normal state
        var normalTI = manager.textureInfoForFilename( filename );
        Vector2 textureCoords = new Vector2(normalTI.frame.x, normalTI.frame.y);

        var frame = new Rect( xPos, yPos, normalTI.frame.width, normalTI.frame.height );

        // create the button
        return new UIColorPicker( manager, frame, depth, normalTI.uvRect, textureCoords );
    }
Exemplo n.º 13
0
    public static UIColorPicker create(UIToolkit manager, string filename, int xPos, int yPos, int depth)
    {
        // grab the texture details for the normal state
        var     normalTI      = manager.textureInfoForFilename(filename);
        Vector2 textureCoords = new Vector2(normalTI.frame.x, normalTI.frame.y);

        var frame = new Rect(xPos, yPos, normalTI.frame.width, normalTI.frame.height);

        // create the button
        return(new UIColorPicker(manager, frame, depth, normalTI.uvRect, textureCoords));
    }
Exemplo n.º 14
0
    public static UIStateButton create(UIToolkit manager, string[] filenames, string[] highlightedFilenames, int xPos, int yPos, int depth)
    {
        // grab the texture details for the initial state
        var firstNormalTI = manager.textureInfoForFilename(filenames[0]);
        var frame         = new Rect(xPos, yPos, firstNormalTI.frame.width, firstNormalTI.frame.height);

        // get the initial highlighted state
        var firstHighlightedTI = firstNormalTI;

        if (highlightedFilenames.Length > 0)
        {
            manager.textureInfoForFilename(highlightedFilenames[0]);
        }

        var button = new UIStateButton(manager, frame, depth, firstNormalTI.uvRect, firstHighlightedTI.uvRect);

        button.addFrames(filenames, highlightedFilenames);

        return(button);
    }
Exemplo n.º 15
0
    public UIVerticalPanel(UIToolkit manager, string topFilename, string middleFilename, string bottomFilename) : base(UILayoutType.Vertical)
    {
        var texInfo = manager.textureInfoForFilename(topFilename);

        _topStrip = manager.addSprite(topFilename, 0, 0, 5);
        _topStrip.parentUIObject = this;
        _topStripHeight          = (int)texInfo.frame.height;
        _width = texInfo.frame.width;

        // we overlap the topStrip 1 pixel to ensure we get a good blend here
        _middleStrip = manager.addSprite(middleFilename, 0, _topStripHeight, 5);
        _middleStrip.parentUIObject = this;

        texInfo      = manager.textureInfoForFilename(middleFilename);
        _bottomStrip = manager.addSprite(bottomFilename, 0, 0, 5);
        _bottomStrip.parentUIObject = this;
        _bottomStripHeight          = (int)texInfo.frame.height;

        // HACK: Gabo edit. Adding the sprites uiChildArray so they can be deleted
        addUIChild(_topStrip, _middleStrip, _bottomStrip);
    }
	public static UISlider create( UIToolkit manager, string knobFilename, string trackFilename, int trackxPos, int trackyPos, UISliderLayout layout, int depth = 2, bool knobInFront = true )
	{
		// create the track first so we can use its dimensions to position the knob		
		var trackTI = manager.textureInfoForFilename( trackFilename );
		var trackFrame = new Rect( trackxPos, trackyPos, trackTI.frame.width, trackTI.frame.height );

		// create a knob using our cacluated position
		var knobDepth = knobInFront ? depth - 1 : depth + 1;
		var knob = manager.addSprite( knobFilename, trackxPos, trackyPos, knobDepth, true );
		
		return new UISlider( manager, trackFrame, depth, trackTI.uvRect, knob, layout );
	}
Exemplo n.º 17
0
    public UIVerticalPanel( UIToolkit manager, string topFilename, string middleFilename, string bottomFilename )
        : base(UILayoutType.Vertical)
    {
        var texInfo = manager.textureInfoForFilename( topFilename );
        _topStrip = manager.addSprite( topFilename, 0, 0, 5 );
        _topStrip.parentUIObject = this;
        _topStripHeight = (int)texInfo.frame.height;
        _width = texInfo.frame.width;

        // we overlap the topStrip 1 pixel to ensure we get a good blend here
        _middleStrip = manager.addSprite( middleFilename, 0, _topStripHeight , 5 );
        _middleStrip.parentUIObject = this;

        texInfo = manager.textureInfoForFilename( middleFilename );
        _bottomStrip = manager.addSprite( bottomFilename, 0, 0, 5 );
        _bottomStrip.parentUIObject = this;
        _bottomStripHeight = (int)texInfo.frame.height;

        // HACK: Gabo edit. Adding the sprites uiChildArray so they can be deleted
        addUIChild( _topStrip, _middleStrip, _bottomStrip );
    }
Exemplo n.º 18
0
	/// <summary>
	/// Creates a swipe detector with a texture backing the hit area
	/// </summary>
	public static UISwipeDetector create( UIToolkit manager, string filename, int xPos, int yPos, int depth )
	{
		// grab the texture details
		var normalTI = manager.textureInfoForFilename( filename );
		var frame = new Rect( xPos, yPos, normalTI.frame.width, normalTI.frame.height );

		// create the swipe detector
		var detector = new UISwipeDetector( frame, depth, normalTI.uvRect );
		manager.addTouchableSprite( detector );
		
		return detector;
	}
	public static UIProgressBar create( UIToolkit manager, string barFilename, int xPos, int yPos, bool rightToLeft, int depth )
	{
		var textureInfo = manager.textureInfoForFilename( barFilename );
		var frame = new Rect( xPos, yPos, textureInfo.frame.width, textureInfo.frame.height );
		
		if( rightToLeft )
			frame.x = xPos + (int)textureInfo.frame.width;

		var progressBar = new UIProgressBar( manager, frame, depth, textureInfo.uvRect, rightToLeft );
		
		return progressBar;
	}
Exemplo n.º 20
0
    public static UISlider create(UIToolkit manager, string knobFilename, string trackFilename, int trackxPos, int trackyPos, UISliderLayout layout, int depth = 2, bool knobInFront = true)
    {
        // create the track first so we can use its dimensions to position the knob
        var trackTI    = manager.textureInfoForFilename(trackFilename);
        var trackFrame = new Rect(trackxPos, trackyPos, trackTI.frame.width, trackTI.frame.height);

        // create a knob using our cacluated position
        var knobDepth = knobInFront ? depth - 1 : depth + 1;
        var knob      = manager.addSprite(knobFilename, trackxPos, trackyPos, knobDepth, true);

        return(new UISlider(manager, trackFrame, depth, trackTI.uvRect, knob, layout));
    }
    public static UIStateSprite create(UIToolkit manager, string[] filenames, int xPos, int yPos, int depth)
    {
        // Grab the texture details for the initial state
        UITextureInfo firstNormalTI = manager.textureInfoForFilename(filenames[0]);
        Rect frame = new Rect(xPos, yPos, firstNormalTI.frame.width, firstNormalTI.frame.height);

        // create the button
        UIStateSprite sprite = new UIStateSprite(manager, frame, depth, firstNormalTI.uvRect);
        // Add frames
        sprite.addFrames(filenames);

        return sprite;
    }
Exemplo n.º 22
0
    /// <summary>
    /// Creates a swipe detector with a texture backing the hit area
    /// </summary>
    public static UISwipeDetector create(UIToolkit manager, string filename, int xPos, int yPos, int depth)
    {
        // grab the texture details
        var normalTI = manager.textureInfoForFilename(filename);
        var frame    = new Rect(xPos, yPos, normalTI.frame.width, normalTI.frame.height);

        // create the swipe detector
        var detector = new UISwipeDetector(frame, depth, normalTI.uvRect);

        manager.addTouchableSprite(detector);

        return(detector);
    }
Exemplo n.º 23
0
    public static UIStateSprite create(UIToolkit manager, string[] filenames, int xPos, int yPos, int depth)
    {
        // Grab the texture details for the initial state
        UITextureInfo firstNormalTI = manager.textureInfoForFilename(filenames[0]);
        Rect          frame         = new Rect(xPos, yPos, firstNormalTI.frame.width, firstNormalTI.frame.height);

        // create the button
        UIStateSprite sprite = new UIStateSprite(manager, frame, depth, firstNormalTI.uvRect);

        // Add frames
        sprite.addFrames(filenames);

        return(sprite);
    }
    public static UIProgressBar create(UIToolkit manager, string barFilename, int xPos, int yPos, bool rightToLeft, int depth)
    {
        var textureInfo = manager.textureInfoForFilename(barFilename);
        var frame       = new Rect(xPos, yPos, textureInfo.frame.width, textureInfo.frame.height);

        if (rightToLeft)
        {
            frame.x = xPos + (int)textureInfo.frame.width;
        }

        var progressBar = new UIProgressBar(manager, frame, depth, textureInfo.uvRect, rightToLeft);

        return(progressBar);
    }
Exemplo n.º 25
0
	public static UISlider create( UIToolkit manager, string knobFilename, string trackFilename, int trackxPos, int trackyPos, UISliderLayout layout )
	{
		// create the track first so we can use its dimensions to position the knob		
		var trackTI = manager.textureInfoForFilename( trackFilename );
		var trackFrame = new Rect( trackxPos, trackyPos, trackTI.frame.width, trackTI.frame.height );
		
		// position the knob based on the knobs size, layout and the track size
		if( layout == UISliderLayout.Horizontal )
			trackyPos += (int)trackTI.frame.height / 2;
		else
			trackxPos += (int)trackTI.frame.width / 2;

		// create a knob using our cacluated position
		var knob = manager.addSprite( knobFilename, trackxPos, trackyPos, 1, true );
		
		return new UISlider( manager, trackFrame, 2, trackTI.uvRect, knob, layout, trackTI.rotated );
	}
Exemplo n.º 26
0
	public UIText( UIToolkit manager, string fontFilename, string textureFilename )
	{
		_manager = manager;
		_fontDetails = new UIFontCharInfo[256];
		for( int i = 0; i < _fontDetails.Length; i++ )
			_fontDetails[i] = new UIFontCharInfo();
		
		loadConfigfile( fontFilename );
		
		// grab the texture offset from the UI
		var rect = _manager.frameForFilename( textureFilename );
		
		// Since the font config data adjusts for padding, but TexturePacker trimming removes it,
		// We need to sub out the trimmed amount coming back from the manager.
		var info = _manager.textureInfoForFilename( textureFilename );
		
		this._textureOffset = new Vector2( rect.x - info.spriteSourceSize.x, rect.y - info.spriteSourceSize.y );
	}
Exemplo n.º 27
0
    public UIText( UIToolkit manager, string fontFilename, string textureFilename )
    {
        _manager = manager;
        _fontDetails = new UIFontCharInfo[256];
        for( int i = 0; i < _fontDetails.Length; i++ )
            _fontDetails[i] = new UIFontCharInfo();

        loadConfigfile( fontFilename );

        // grab the texture offset from the UI
        var rect = _manager.frameForFilename( textureFilename );

        // Since the font config data adjusts for padding, but TexturePacker trimming removes it,
        // We need to sub out the trimmed amount coming back from the manager.
        var info = _manager.textureInfoForFilename( textureFilename );

        this._textureOffset = new Vector2( rect.x - info.sourceSize.x, rect.y - info.sourceSize.y );
    }
Exemplo n.º 28
0
    // the knobs x/y coordinates should be relative to the tracks and it is measured from the center of the knob
    public static UISlider create(UIToolkit manager, string knobFilename, string trackFilename, int trackxPos, int trackyPos, UISliderLayout layout)
    {
        // create the track first so we can use its dimensions to position the knob
        var trackTI    = manager.textureInfoForFilename(trackFilename);
        var trackFrame = new Rect(trackxPos, trackyPos, trackTI.size.x, trackTI.size.y);

        // position the knob based on the knobs size, layout and the track size
        if (layout == UISliderLayout.Horizontal)
        {
            trackyPos += (int)trackTI.size.y / 2;
        }
        else
        {
            trackxPos += (int)trackTI.size.x / 2;
        }

        // create a knob using our cacluated position
        var knob = manager.addSprite(knobFilename, trackxPos, trackyPos, 1, true);

        return(new UISlider(manager, trackFrame, 2, trackTI.uvRect, knob, layout));
    }
Exemplo n.º 29
0
    // the bars x/y coordinates should be relative to the borders
    public static UIProgressBar create(UIToolkit manager, string barFilename, string borderFilename, int barxPos, int baryPos, int borderxPos, int borderyPos, bool rightToLeft)
    {
        var borderTI = manager.textureInfoForFilename(borderFilename);

        var borderFrame = new Rect(borderxPos, borderyPos, borderTI.frame.width, borderTI.frame.height);

        UISprite bar;

        if (rightToLeft)
        {
            bar = manager.addSprite(barFilename, borderxPos - barxPos + ((int)borderTI.frame.width), borderyPos + baryPos, 2);
        }
        else
        {
            bar = manager.addSprite(barFilename, borderxPos + barxPos, borderyPos + baryPos, 2);
        }

        var progressBar = new UIProgressBar(manager, borderFrame, 1, borderTI.uvRect, bar);

        progressBar.rightToLeft = rightToLeft;

        return(progressBar);
    }
Exemplo n.º 30
0
    // the bars x/y coordinates should be relative to the borders
    public static UIProgressBar create( UIToolkit manager, string barFilename, string borderFilename, int barxPos, int baryPos, int borderxPos, int borderyPos, bool rightToLeft, int depth, bool barInFront = true )
    {
        var borderTI = manager.textureInfoForFilename( borderFilename );

        var borderFrame = new Rect( borderxPos, borderyPos, borderTI.frame.width, borderTI.frame.height );

        UISprite bar;

        if( rightToLeft )
            bar = manager.addSprite( barFilename, borderxPos - barxPos + ((int)borderTI.frame.width), borderyPos + baryPos, depth );
        else
            bar = manager.addSprite( barFilename, borderxPos + barxPos, borderyPos + baryPos, depth );

        var barDepth = barInFront ? depth - 1 : depth + 1;
        var progressBar = new UIProgressBar( manager, borderFrame, barDepth, borderTI.uvRect, bar );
        progressBar.rightToLeft = rightToLeft;

        return progressBar;
    }
Exemplo n.º 31
0
    public void setJoystickHighlightedFilename(string filename)
    {
        var textureInfo = _manager.textureInfoForFilename(filename);

        highlightedUVframe = textureInfo.uvRect;
    }
Exemplo n.º 32
0
    // the bars x/y coordinates should be relative to the borders
    public static UIProgressBar create( UIToolkit manager, string barFilename, string borderFilename, int barxPos, int baryPos, int borderxPos, int borderyPos )
    {
        var bar = manager.addSprite( barFilename, borderxPos + barxPos, borderyPos + baryPos, 2 );

        var borderTI = manager.textureInfoForFilename( borderFilename );
        var borderFrame = new Rect( borderxPos, borderyPos, borderTI.frame.width, borderTI.frame.height );

        return new UIProgressBar( manager, borderFrame, 1, borderTI.uvRect, bar );
    }
	/// <summary>
	/// Create a Slice-9 touchable sprite
	/// </summary>
	/// <param name='manager'>
	/// Manager.
	/// </param>
	/// <param name='filename'>
	/// Filename.
	/// </param>
	/// <param name='highlightedFilename'>
	/// Highlighted filename.
	/// </param>
	/// <param name='xPos'>
	/// X position.
	/// </param>
	/// <param name='yPos'>
	/// Y position.
	/// </param>
	/// <param name='width'>
	/// Width.
	/// </param>
	/// <param name='height'>
	/// Height.
	/// </param>
	/// <param name='sTP'>
	/// Top Margin
	/// </param>
	/// <param name='sRT'>
	/// Right Margin
	/// </param>
	/// <param name='sBT'>
	/// Bottom Margin
	/// </param>
	/// <param name='sLT'>
	/// Left Margin
	/// </param>
	public static UISlice9 create( UIToolkit manager, string filename, string highlightedFilename, int xPos, int yPos, int width, int height, int sTP, int sRT, int sBT, int sLT, int depth )
	{
		// grab the texture details for the normal state
		var normalTI = manager.textureInfoForFilename( filename );
		var frame = new Rect( xPos, yPos, normalTI.frame.width, normalTI.frame.height );
		
		// get the highlighted state
		var highlightedTI = manager.textureInfoForFilename( highlightedFilename );
		
		// create the button
		return new UISlice9( manager, frame, depth, normalTI.uvRect, highlightedTI.uvRect, width, height, sTP, sRT, sBT, sLT );
	}