本文整理汇总了C#中Stage.addChild方法的典型用法代码示例。如果您正苦于以下问题:C# Stage.addChild方法的具体用法?C# Stage.addChild怎么用?C# Stage.addChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stage
的用法示例。
在下文中一共展示了Stage.addChild方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Activate
void Activate()
{
if (GameObject.Find("Main Camera").GetComponent<MovieClipOverlayCameraBehaviour>() == null)
{
return;
}
PauseStage = Camera.main.GetComponent<MovieClipOverlayCameraBehaviour>().stage;
BackGround = new MovieClip("swf/PauseField.swf:FadeBackground");
BackGround.gotoAndStop(1);
BackGround.x = Screen.width / 2;
BackGround.y = Screen.height / 2;
BackGround.scaleX = (float)Screen.width / 2048;
BackGround.scaleY = BackGround.scaleX;
PauseStage.addChild(BackGround);
for (int i = 0; i < ButtonCount; i++)
{
Buttons[i] = new MovieClip("swf/PauseField.swf:PauseField");
Buttons[i].gotoAndStop(1);
Buttons[i].x = Screen.width/2;
Buttons[i].y = Screen.height * 0.3f + (float)Screen.height/2048 * 220 * i;
Buttons[i].scaleX = (float)Screen.width / 2048;
Buttons[i].scaleY = Buttons[i].scaleX;
MenuFields[i] = Buttons[i].getChildByName<TextField>("Text");
MenuFields[i].text = names[i];
PauseStage.addChild(Buttons[i]);
}
Buttons[0].addEventListener(MouseEvent.CLICK, Resume);
Buttons[1].addEventListener(MouseEvent.CLICK, Reload);
Buttons[3].addEventListener(MouseEvent.CLICK, Quit);
}
示例2: Start
void Start () {
// Validate MovieClipOverlayCameraBehaivour is attached to camera
if( MovieClipOverlayCameraBehaviour.instance == null ) {
Debug.LogError( "Failed to get MovieClipOverlayCameraBehaviour, ensure its attached to the MainCamera" );
return;
}
// Assign stage reference
stage = MovieClipOverlayCameraBehaviour.instance.stage;
// Create menu clip
MovieClip btn = new MovieClip( "uniSWF/Examples/Tutorial 02 - Basic button script/swf/Tut02-ButtonAsset.swf:btn_ui" );
// Center on stage for the current screen size
btn.x = (stage.stageWidth / 2) - (btn.srcWidth/2);
btn.y = (stage.stageHeight / 2) - (btn.srcHeight/2);
// Jump to first frame and stop
btn.gotoAndStop(1);
// Inner display object such as text fields will not recieve events
btn.mouseChildrenEnabled = false;
// Event listeners
btn.addEventListener( MouseEvent.CLICK, onButtonClick);
btn.addEventListener( MouseEvent.MOUSE_ENTER, onButtonEnter);
btn.addEventListener( MouseEvent.MOUSE_LEAVE, onButtonLeave);
// Add menu clip to stage
stage.addChild(btn);
}
示例3: ShowLevelComplete
void ShowLevelComplete(int Level) {
if (GameObject.Find("Main Camera").GetComponent<MovieClipOverlayCameraBehaviour>() == null)
{
return;
}
st = Camera.main.GetComponent<MovieClipOverlayCameraBehaviour>().stage;
ChangeLevel = new MovieClip("swf/LevelPassed.swf:LevelUP");
ChangeLevel.x = Screen.width / 2;
ChangeLevel.y = Screen.height / 2;
ChangeLevel.scaleX = (float)Screen.width / 2048;
ChangeLevel.scaleY = ChangeLevel.scaleX;
Text = ChangeLevel.getChildByName<TextField>("Layer1");
Text.text = "Level " + Level.ToString();
st.addChild(ChangeLevel);
ChangeLevel.gotoAndPlay(1);
Playing = true;
}
示例4: Start
void Start()
{
gm = GameObject.Find("GameManager").GetComponent<GameManager>();
bm = GameObject.Find("BattleManager").GetComponent<BattleManager>();
em = GameObject.Find("EventManager").GetComponent<EventManager>();
// validate MovieClipOverlayCameraBehaviour ist attached to camera
if (MovieClipOverlayCameraBehaviour.instance == null) {
return;
}
// assign stage reference
stage = MovieClipOverlayCameraBehaviour.instance.stage;
//bottom timeline
menu = new MovieClip ("Flash GUI/game_gui.swf:hover_menu");
move_button = (MovieClip)menu.getChildByName ("move_btn");
attack_button = (MovieClip)menu.getChildByName ("attack_btn");
defend_button = (MovieClip)menu.getChildByName ("defend_btn");
magic_button = (MovieClip)menu.getChildByName ("magic_btn");
wait_button = (MovieClip)menu.getChildByName ("wait_btn");
move_button.addEventListener(MouseEvent.CLICK, onMoveButton);
attack_button.addEventListener(MouseEvent.CLICK, onAttackButton);
defend_button.addEventListener(MouseEvent.CLICK, onDefendButton);
magic_button.addEventListener(MouseEvent.CLICK, onSpellButton);
wait_button.addEventListener(MouseEvent.CLICK, onWaitButton);
//create a list and store buttons in list
buttonList = new List<MovieClip> ();
buttonList.Add (move_button);
buttonList.Add (attack_button);
buttonList.Add (defend_button);
buttonList.Add (magic_button);
buttonList.Add (wait_button);
menu.x = 100;
menu.y = 100;
menu.scaleX = scale_factor;
menu.scaleY = scale_factor;
//add listeners to each button in the list and stop the animations from playing
updateListeners (buttonList);
stage.addChild (menu);
menu.visible = false;
em.UnitsReadyEvent += make_team_frame;
}
示例5: Start
void Start ()
{
if (GameObject.Find("Main Camera").GetComponent<MovieClipOverlayCameraBehaviour>() == null)
{
return;
}
stage = Camera.main.GetComponent<MovieClipOverlayCameraBehaviour>().stage;
Menu = new MovieClip("swf/MenuBar.swf:MenuBar");
Menu.gotoAndStop(1);
Menu.x = Screen.width;
Menu.y = Screen.height;
Menu.scaleX = (float)Screen.width / ScaleParameterX;
Menu.scaleY = (float)Screen.width/ScaleParameterY;
Name = Menu.getChildByName<TextField>("Name");
Name.text = "";
Level = Menu.getChildByName<TextField>("Level");
Level.text = "";
Score = Menu.getChildByName<TextField>("Score");
Score.text = "Score: 0";
Credits = Menu.getChildByName<TextField>("Credits");
Credits.text = "Credits:0";
Info = Menu.getChildByName<TextField>("Info");
Info.text = "";
Pause = new MovieClip("swf/PauseMute.swf:Pause");
Pause.gotoAndStop(1);
Pause.x = Screen.width;
Pause.y = 0;
Pause.scaleX = (float)Screen.width / ScaleParameterX;
Pause.scaleY = (float)Screen.width / ScaleParameterY;
Pause.addEventListener(MouseEvent.CLICK,OnPauseClick);
Mute = new MovieClip("swf/PauseMute.swf:Mute");
Mute.gotoAndStop(1);
Mute.x = Screen.width;
Mute.y = 0;
Mute.scaleX = (float)Screen.width / ScaleParameterX;
Mute.scaleY = (float)Screen.width / ScaleParameterY;
//Mute.addEventListener(MouseEvent.CLICK, OnMuteClick);
Create = new MovieClip("swf/MenuBar.swf:CannonCreate");
Create.gotoAndStop(1);
Create.x = Screen.width;
Create.y = Screen.height;
Create.scaleX = (float)Screen.width / ScaleParameterX;
Create.scaleY = (float)Screen.width / ScaleParameterY;
Create.addEventListener(MouseEvent.MOUSE_DOWN, CreationClick);
Bonus = new MovieClip("swf/Bonus.swf:Bonus1");
Bonus.gotoAndStop(1);
Bonus.x = Screen.width - 90;
Bonus.y = Screen.height / 2 + 20;
Bonus.scaleX = (float)Screen.width / ScaleParameterX;
Bonus.scaleY = (float)Screen.width / ScaleParameterY;
stage.addChild(Menu);
stage.addChild(Pause);
stage.addChild(Mute);
stage.addChild(Create);
stage.addChild(Bonus);
}