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); }
public DisplayObject addView(DisplayObject view) { if (stack.IndexOf(view) == -1) { stack.Add(view); srcClip.addChild(view); } return(view); }
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); }
private void assetsProg(float val) { if (val == 1.0f) { var background = new Image(assets.getTexture("background")); stage.addChild(background); Game.viewManager.setView(new MainMenu()); } }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { base.Initialize(); InputHelper.Initialize(); //Initialise the final rendering viewport - this will allow the user to size the rendered image to match their display device SetRenderViewport(); PostProcess.Initialize(); Stage = new Stage(); _game = new Game(); Stage.addChild(_game); }
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; }
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; }
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); }