本文整理匯總了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);
}