Esempio n. 1
0
    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);
    }
Esempio n. 2
0
	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);
	}
Esempio n. 3
0
 void Start()
 {
     ButtonField = Resources.Load("Prefabs/ButtonField") as GameObject;
     InfoField = new MovieClip("swf/Ellipse.swf:InfoField");
     InfoField.gotoAndStop(1);
     CannonName = InfoField.getChildByName<TextField>("CannonName");
     Cost = InfoField.getChildByName<TextField>("Cost");
     Info = InfoField.getChildByName<TextField>("Info");
 }
Esempio n. 4
0
    public void Update()
    {
        if (turrentTrans == null)
        {
            return;
        }

        if (Input.GetMouseButtonDown(0))
        {
            //alternate turrent state.
            string _currentType = turrentMovieClip.currentLocalFrameName();
            if (_currentType == "type1")
            {
                turrentMovieClip.gotoAndPlay("type2");
            }
            else if (_currentType == "type2")
            {
                turrentMovieClip.gotoAndPlay("type1");
            }
        }

        if (targetStateChangeInterval < 5)
        {
            targetStateChangeInterval++;
            return;
        }
        else
        {
            targetStateChangeInterval = 0;
        }

        if (isHit)
        {
            isHit = false;
            if (target.currentFrame < target.mcTimeLineInfo.totalFrames)
            {
                target.gotoAndStop(target.currentFrame + 1);
            }
            else
            {
                target.gotoAndStop(1);
            }
        }
    }
Esempio n. 5
0
    void GenerateEllipse()
    {
        Ellipse = new MovieClip("swf/Ellipse.swf:Elipse");


        Ellipse.gotoAndStop(1);

        Ellipse.x = (GeneratePosition.x + 405) * Screen.width / ScaleX;
        Ellipse.y = -1 * (GeneratePosition.z - 242) * Screen.height / ScaleY;
        Ellipse.scaleX = (float)Screen.width / ScaleParameter;
        Ellipse.scaleY = Ellipse.scaleX;

        stage.addChild(Ellipse);
    }
Esempio n. 6
0
    void Start()
    {
        //Create instances of MovieClip by code.
        FlashUtils.getMovieClipByClassNameAndAddTo("Game_ShootGameDis", transform).selfTrans.position = new Vector3(0f, -2f, 0f);

        FlashUtils.getMovieClipByClassNameAndAddTo("Animation_PerformanceTest", transform).selfTrans.position = new Vector3(0f, -3.22f, 0f);
        MovieClip _upMovieClip = FlashUtils.getMovieClipByClassNameAndAddTo("Animation_PerformanceTest", transform);

        _upMovieClip.selfTrans.position = new Vector3(0f, 3.22f, 0f);
        _upMovieClip.selfTrans.rotation = Quaternion.Euler(new Vector3(0f, 0f, 180f));
        _upMovieClip.gotoAndStop(_upMovieClip.mcTimeLineInfo.totalFrames);//All frog add to stage at same frame.Then stop as last frame.

        FlashUtils.getMovieClipByClassNameAndAddTo("Trail_DisTrailBackAndForthGroupCircle", transform).selfTrans.position = new Vector3(4f, 2.5f, 0f);
        FlashUtils.getMovieClipByClassNameAndAddTo("Trail_DisTrailLineRotate", transform).selfTrans.position = new Vector3(-4f, 2.5f, 0f);
    }
Esempio n. 7
0
    /**
    * Intiailise HUD
    */
    void Start () {	    
	    mainLight = GameObject.Find("MainLight").GetComponent<Light>();
	    panelState = STATE_IDLE;
	
	    mc = gameObject.GetComponent<MovieClipBehaviour>();
	    if( mc == null ) {
		    Debug.LogError( "MovieClipBehaviour missing on '" + name + "'" );
		    return;
	    }
	    clip = mc.movieClip;
	
	    // Set default player mode
	    initDisabledInteraction();
	    clip.gotoAndStop( 1 );
	    mainLight.intensity = minMainLight;
	
	    startScale.x = mc.stage.scaleX;
	    startScale.y = mc.stage.scaleY;
    }
    public void SetButtonState(ButtonState _buttonState)
    {
        buttonState = _buttonState;
        string frameLabel = "up";

        switch (buttonState)
        {
        case ButtonState.up:
            frameLabel = "up";
            break;

        case ButtonState.down:
            frameLabel = "dn";
            break;

        case ButtonState.over:
            frameLabel = "ov";
            break;

        case ButtonState.ghost:
            frameLabel = "gh";
            break;
        }

        mc.gotoAndStop(frameLabel);

        TextField     txtField      = mc.getChildByName <TextField>("tfLabel");
        LocalizedText localizedText = new LocalizedText(txtField, text);

        if (resizable)
        {
            txtField.multiline = false;
            centerMc.gotoAndStop(frameLabel);
            leftMc.gotoAndStop(frameLabel);
            rightMc.gotoAndStop(frameLabel);

            string translatedStr = localizedText.BaseText;

            float letterSpacing = txtField.textFormat.letterSpacing;
            float strLength     = 0.0f;
            for (int k = 0; k < translatedStr.Length; k++)
            {
                strLength = strLength + txtField.getGlyph(translatedStr[k]).charWidth + letterSpacing;
            }

            int textFieldLength = (int)(strLength + 20); // 16 * translationText.BaseText.Length;

            float textLength;
            if (icon)
            {
                textLength = textFieldLength + iconMc.width;
            }
            else
            {
                textLength = textFieldLength;
            }

            centerMc.scaleX = 1.0f;
            centerMc.scaleX = textLength / 20; // larghezza base di centerMc

            int centerWidth = Mathf.CeilToInt(centerMc.width);
            if (centerWidth % 2 > 0)
            {
                centerWidth--;
            }

            if (alignment == Alignment.center)
            {
                centerMc.x = centerX;
                rightMc.x  = centerMc.x + centerWidth * 0.5f;
                leftMc.x   = centerMc.x - centerWidth * 0.5f - leftMc.width;
            }
            else if (alignment == Alignment.right)
            {
                leftMc.x   = leftX;
                centerMc.x = leftMc.x + leftMc.width + centerMc.width * 0.5f;
                rightMc.x  = centerMc.x + centerWidth * 0.5f;
            }
            else if (alignment == Alignment.left)
            {
                rightMc.x  = rightX;
                centerMc.x = rightMc.x - centerWidth * 0.5f;
                leftMc.x   = centerMc.x - centerWidth * 0.5f - leftMc.width;
            }

            txtField.x     = centerMc.x - textLength * 0.5f;
            txtField.width = textFieldLength;


            if (iconMc != null)
            {
                iconMc.x = Mathf.FloorToInt(txtField.x + txtField.width + 10.0f);
            }
        }
        else
        {
            bgMc.gotoAndStop(frameLabel);
        }

        if (iconMc != null)
        {
            iconMc.visible = icon;
            iconMc.gotoAndStop(iconLabel);
        }
    }
Esempio n. 9
0
	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);
	}