本文整理汇总了C#中UnityEngine.Sprite.addChild方法的典型用法代码示例。如果您正苦于以下问题:C# Sprite.addChild方法的具体用法?C# Sprite.addChild怎么用?C# Sprite.addChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.Sprite
的用法示例。
在下文中一共展示了Sprite.addChild方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Button
public Button(DisplayObject upState, string text ="", DisplayObject downState=null, TextFormat format=null)
{
//if (upState == null) throw new ErrorEvent("Texture cannot be null");
mParent = upState.parent;
mUpState = upState;
mDownState = downState != null ? downState : upState;
mBackground = upState;
mTextFormat = format;
mScaleWhenDown = 0.9f;
mAlphaWhenDisabled = 0.5f;
mEnabled = true;
mIsDown = false;
mUseHandCursor = true;
mTextBounds = new Rectangle(0, 0, upState.width, upState.height);
mContents = new Sprite();
mContents.addChild(mBackground);
addChild(mContents);
//addEventListener(TouchEvent.TOUCH, onTouch);
addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
if (text.Length > 0) this.text = text;
this.x = upState.x;
this.y = upState.y;
upState.x = upState.y = 0;
if(mParent != null)
(mParent as MovieClip).addChild(this);
}