当前位置: 首页>>代码示例>>C#>>正文


C# UIToolkit.addSprite方法代码示例

本文整理汇总了C#中UIToolkit.addSprite方法的典型用法代码示例。如果您正苦于以下问题:C# UIToolkit.addSprite方法的具体用法?C# UIToolkit.addSprite怎么用?C# UIToolkit.addSprite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UIToolkit的用法示例。


在下文中一共展示了UIToolkit.addSprite方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UIPeaceMakerActor

    //constructor
    public UIPeaceMakerActor(UIToolkit toolkit, string actorName, string fileName)
    {
        //todo make this scalable
        _height = 50; //background image size
        _width = 50;

        _touchFrame = new Rect ( position.x, -position.y, _width, _height );

        //background image is always the same
        _actorBackground = toolkit.addSprite("actorBG.png", 0, 0);
        _actorBackground.parentUIObject = this;
        _actorBackground.positionFromTopLeft (0f, 0f);

        //gradient is always the same
        _actorGradient = toolkit.addSprite ("actor_gradient_white.png", 0, 0);
        _actorGradient.parentUIObject = this;
        _actorGradient.positionFromTopLeft (0f, 0f);

        //image and button
        _theButton = UIButton.create (toolkit, fileName, fileName, 0, 0);
        _theButton.parentUIObject = this;
        _theButton.onTouchUpInside += ( sender ) =>  randomAttitudeTest ();

        //up/down arrow is always the same
        _actorArrow = toolkit.addSprite ("up_arrow_anim_00.png", 0, 0);
        _actorArrow.parentUIObject = this;
        _actorArrow.positionFromTopRight (0f, 0f);

        _arrowUpAnim = _actorArrow.addSpriteAnimation ("arrowUpAnim", 0.1f, "up_arrow_anim_00.png", "up_arrow_anim_01.png", "up_arrow_anim_02.png", "up_arrow_anim_03.png", "up_arrow_anim_04.png", "up_arrow_anim_05.png", "up_arrow_anim_06.png", "up_arrow_anim_07.png", "up_arrow_anim_08.png", "up_arrow_anim_09.png");
        _arrowDownAnim = _actorArrow.addSpriteAnimation ("arrowDownAnim", 0.1f, "down_arrow_anim_00.png", "down_arrow_anim_01.png", "down_arrow_anim_02.png", "down_arrow_anim_03.png", "down_arrow_anim_04.png", "down_arrow_anim_05.png", "down_arrow_anim_06.png", "down_arrow_anim_07.png", "down_arrow_anim_08.png", "down_arrow_anim_09.png");
        _arrowUpAnim.loopReverse = true;
        _arrowDownAnim.loopReverse = true;

        hideAttitudeIndicators ();
    }
开发者ID:hybridsteve,项目名称:dicebaseballapp,代码行数:36,代码来源:UIPeaceMakerActor.cs

示例2: UITexture

    public UITexture( UIToolkit manager, Rect frame, int depth, UIUVRect uvFrame)
        : base(frame, depth, uvFrame)
    {
        _normalUVframe = uvFrame;

        manager.addSprite( this );
    }
开发者ID:reissgrant,项目名称:UIToolkit,代码行数:7,代码来源:UITexture.cs

示例3: create

    public static UIGhostJoystick create( UIToolkit manager, string joystickFilename, Rect hitArea )
    {
        // create the joystrick sprite
        var joystick = manager.addSprite( joystickFilename, 0, 0, 1, true );

        return new UIGhostJoystick( manager, hitArea, 1, joystick);
    }
开发者ID:hyakugei,项目名称:UIToolkit,代码行数:7,代码来源:UIGhostJoystick.cs

示例4: create

	// 
	public static UIJoystick create( UIToolkit manager, string joystickFilename, Rect hitAreaFrame, float xPos, float yPos )
	{
		// create the joystrick sprite
		var joystick = manager.addSprite( joystickFilename, 0, 0, 1, true );
		
		return new UIJoystick( manager, hitAreaFrame, 1, joystick, xPos, yPos );
	}
开发者ID:n8stowell82,项目名称:UIToolkit,代码行数:8,代码来源:UIJoystick.cs

示例5: UIProgressBar

    public UIProgressBar( UIToolkit manager, Rect frame, int depth, UIUVRect uvFrame, UISprite bar, bool rotated )
        : base(frame, depth, uvFrame, rotated)
    {
        // Save the bar and make it a child of the container/border for organization purposes
        _bar = bar;
        _bar.parentUIObject = this;

        _barOriginalWidth = _bar.width;
        _barOriginalHeight = _bar.height;

        /*
        // Save the bars original size
        if (rotated)
        {
            _barOriginalWidth = _bar.width;
            _barOriginalHeight = _bar.height;
        }
        else
        {
            _barOriginalWidth = _bar.width;
            _barOriginalHeight = _bar.height;
        }
        */

        /*if (!_rotated)
                    normalFrame = new Rect( clientTransform.position.x, -clientTransform.position.y, width * touchesScale.x, height * touchesScale.y);
                else
                    normalFrame = new Rect( clientTransform.position.x, -clientTransform.position.y - (width * touchesScale.y), height * touchesScale.x, width * touchesScale.y);
                    */
        _barOriginalUVframe = _bar.uvFrame;

        manager.addSprite( this );
    }
开发者ID:EskemaGames,项目名称:UIToolkit,代码行数:33,代码来源:UIProgressBar.cs

示例6: UIVerticalPanel

	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;
	}
开发者ID:Raj2509,项目名称:net.kibotu.sandbox.unity.dragnslay,代码行数:17,代码来源:UIVerticalPanel.cs

示例7: UIBackgroundLayout

	public UIBackgroundLayout( UIToolkit manager, string filename ) : base( UILayoutType.BackgroundLayout ) 
	{
		background = manager.addSprite( filename, 0, 0, 2 );
		addChild( background );
		
		// set dimensions of container based on background texture dimensions
		_width = background.width;
		_height = background.height;
	}
开发者ID:Raj2509,项目名称:net.kibotu.sandbox.unity.dragnslay,代码行数:9,代码来源:UIBackgroundLayout.cs

示例8: create

	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 );
	}
开发者ID:Foxzter,项目名称:net.kibotu.sandbox.unity.dragnslay,代码行数:12,代码来源:UISlider.cs

示例9: UIVerticalPanel

    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 );
    }
开发者ID:hybridsteve,项目名称:dicebaseballapp,代码行数:21,代码来源:UIVerticalPanel.cs

示例10: UIProgressBar

    public UIProgressBar( UIToolkit manager, Rect frame, int depth, UIUVRect uvFrame, UISprite bar )
        : base(frame, depth, uvFrame)
    {
        // Save the bar and make it a child of the container/border for organization purposes
        _bar = bar;
        _bar.parentUIObject = this;

        // Save the bars original size
        _barOriginalWidth = _bar.width;
        _barOriginalUVframe = _bar.uvFrame;

        manager.addSprite( this );
    }
开发者ID:nsxdavid,项目名称:UIToolkit,代码行数:13,代码来源:UIProgressBar.cs

示例11: UIProgressBar

	public UIProgressBar( UIToolkit manager, Rect frame, int depth, UIUVRect uvFrame, bool rightToLeft ):base( frame, depth, uvFrame )
	{
		manager.addSprite( this );
		
		// Save the bars original size
		_barOriginalWidth = frame.width;
		_barOriginalUVframe = uvFrame;
		this.rightToLeft = rightToLeft;

		// Update the bar size based on the value
		if( rightToLeft )
			setSize( _value * -_barOriginalWidth, frame.height );
		else
			setSize( _value * _barOriginalWidth, frame.height );
	}
开发者ID:Foxzter,项目名称:net.kibotu.sandbox.unity.dragnslay,代码行数:15,代码来源:UIProgressBar.cs

示例12: create

	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 );
	}
开发者ID:EskemaGames,项目名称:UIToolkit,代码行数:17,代码来源:UISlider.cs

示例13: UIProgressBar

    public UIProgressBar( UIToolkit manager, Rect frame, int depth, UIUVRect uvFrame, UISprite bar )
        : base(frame, depth, uvFrame)
    {
        // Save the bar and make it a child of the container/border for organization purposes
        _bar = bar;
        _bar.parentUIObject = this;

        // Save the bars original size
        _barOriginalWidth = _bar.width;
        _barOriginalUVframe = _bar.uvFrame;

        // Update the bar size based on the value
        if (rightToLeft)
            _bar.setSize(_value * -_barOriginalWidth, _bar.height);
        else
            _bar.setSize(_value * _barOriginalWidth, _bar.height);

        manager.addSprite( this );
    }
开发者ID:githubbar,项目名称:UIToolkit,代码行数:19,代码来源:UIProgressBar.cs

示例14: createTextWrapper

    public static UISprite createTextWrapper( UIToolkit uiTools, UITextInstance text, UIAbstractContainer layout )
    {
        // Get the right wrapping for the text
        setTextLayoutWrap( layout, text );

        // Create the wrapper and scale it
        // TODO: Check if empty.png exists if not then throw a clear error.
        UISprite textWrapper = uiTools.addSprite( "empty.png", 0, 0 );
        textWrapperScale( layout, textWrapper, text );

        // Make the text a child of the wrapper
        text.parentUIObject = textWrapper;
        textWrapper.userData = text;

        textPositionInWrapper( text );

        // Return the wrapper
        return textWrapper;
    }
开发者ID:hybridsteve,项目名称:dicebaseballapp,代码行数:19,代码来源:GUIUtils.cs

示例15: create

	// 
	public static UIJoystick create( UIToolkit manager, string joystickFilename, Rect hitAreaFrame, float xPos, float yPos )
	{
		// create the joystrick sprite
		var joystick = manager.addSprite( joystickFilename, 0, 0, 1, true );
		
		//check if HD is available or not
		//using HD we should increase the hit area by 2, because the double pixel size 
		//of the iphone4, also of course the xpos and ypos also should be updated as well
		if (UI.instance.isHD)
		{
			Rect t = new Rect (hitAreaFrame.x, hitAreaFrame.y, hitAreaFrame.width * 2, hitAreaFrame.height * 2);
			return new UIJoystick( manager, t, 1, joystick,  xPos * 2, yPos * 2);
		}
		else
		{
			return new UIJoystick( manager, hitAreaFrame, 1, joystick,  xPos, yPos );
		}
		
	}
开发者ID:EskemaGames,项目名称:UIToolkit,代码行数:20,代码来源:UIJoystick.cs


注:本文中的UIToolkit.addSprite方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。