本文整理汇总了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 ();
}
示例2: UITexture
public UITexture( UIToolkit manager, Rect frame, int depth, UIUVRect uvFrame)
: base(frame, depth, uvFrame)
{
_normalUVframe = uvFrame;
manager.addSprite( this );
}
示例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);
}
示例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 );
}
示例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 );
}
示例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;
}
示例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;
}
示例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 );
}
示例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 );
}
示例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 );
}
示例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 );
}
示例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 );
}
示例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 );
}
示例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;
}
示例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 );
}
}