Esempio n. 1
0
    // Use this for initialization
    public override void Start()
    {
        transitionIn = InitScript.shouldPlayMenuTransition;
        InitScript.inGame = false;

        background = new Starfield(InitScript.bg1Pos,false);
        Futile.stage.AddChild(background);

        background2 = new Starfield(InitScript.bg2Pos, false);
        Futile.stage.AddChild(background2);

        menuBackground = new FSprite("MenuStatic.png");
        menuBackground.scale = 2.0f;
        menuBackground.x = 0;
        if (InitScript.shouldPlayMenuTransition == true)
            menuBackground.isVisible = false;
        Futile.stage.AddChild(menuBackground);

        menuAnims = new FSprite("Menutoplay6.png");
        if (InitScript.shouldPlayMenuTransition == false)
            menuAnims.SetElementByName("MenuAnim0.png");
        menuAnims.scale = 2.0f;
        menuAnims.x = 0;
        //menuAnims.isVisible = false;
        Futile.stage.AddChild(menuAnims);

        btnInstructions = new FButton("InfoButton.png");
        btnInstructions.x -= 1;
        btnInstructions.y -= 126;
        btnInstructions.scale = 2.0f;
        if (InitScript.shouldPlayMenuTransition == true)
            btnInstructions.isVisible = false;
        Futile.stage.AddChild(btnInstructions);

        btnCredits = new FButton("CreditsButton.png");
        btnCredits.x -= 1;
        btnCredits.y -= 166;
        btnCredits.scale = 2.0f;
        if (InitScript.shouldPlayMenuTransition == true)
            btnCredits.isVisible = false;
        Futile.stage.AddChild(btnCredits);

        btnPlay = new FButton("PlayButton.png");
        btnPlay.x = 0;
        btnPlay.y = 0;
        btnPlay.scale = 2.0f;
        Futile.stage.AddChild(btnPlay);

        InitScript.blackBar1.MoveToTop();
        InitScript.blackBar2.MoveToTop();

        btnInstructions.SignalRelease += HandleInfoButtonRelease;
        btnCredits.SignalRelease += HandleCreditButtonRelease;
        btnPlay.SignalRelease += HandlePlayButtonRelease;

        Futile.instance.SignalUpdate += HandleUpdate;
    }
Esempio n. 2
0
 public Switch(string doorName, string name, World world)
     : base(new RXRect(0,0,7,7), world)
 {
     this.blocksOtherObjects = false;
         this.doorName = doorName;
         sprite = new FSprite("Button/button_01");
         this.AddChild(sprite);
         this.name = name;
         if (C.Save.switchesActivated.Contains(this.name))
         {
             pressed = true;
             sprite.SetElementByName("Button/button_02");
         }
 }
Esempio n. 3
0
 public void SetNewArt()
 {
     customArtSprite.MoveToBack();
     customArtSprite.SetElementByName(arts[currentSelectedIndex]);
     Debug.Log(customArtSprite.element + "|" + customArtSprite.width);
 }
Esempio n. 4
0
    // Use this for initialization
    public override void Start()
    {
        transitionIn = true;
        InitScript.inGame = false;
        background = new Starfield(0,false);
        Futile.stage.AddChild(background);

        background2 = new Starfield(320 + 80, false);
        Futile.stage.AddChild(background2);

        menuBackground = new FSprite("MenuStatic.png");
        menuBackground.scale = 2.0f;
        menuBackground.x = 0;
        menuBackground.isVisible = false;
        Futile.stage.AddChild(menuBackground);

        menuAnims = new FSprite("Menutoplay6.png");
        menuAnims.scale = 2.0f;
        menuAnims.x = 0;
        Futile.stage.AddChild(menuAnims);

        btnInstructions = new FButton("MenuButton.png");
        btnInstructions.x -= 1;
        btnInstructions.y -= 126;
        btnInstructions.scale = 2.0f;
        btnInstructions.isVisible = false;
        Futile.stage.AddChild(btnInstructions);

        btnGameCenter = new FButton("GCButton.png");
        btnGameCenter.x -= 1;
        btnGameCenter.y -= 166;
        btnGameCenter.scale = 2.0f;
        btnGameCenter.isVisible = false;
        Futile.stage.AddChild(btnGameCenter);

        //score stuffffff
        digit1 = new FSprite("0.png");
        digit1.scale = 2.0f;
        digit1.x = -159.7772f + 180;
        digit1.y = Futile.screen.halfHeight - 57;
        Futile.stage.AddChild(digit1);

        digit2 = new FSprite("0.png");
        digit2.scale = 2.0f;
        digit2.x = -159.7772f + 160;
        digit2.y = Futile.screen.halfHeight - 57;
        Futile.stage.AddChild(digit2);

        digit3 = new FSprite("0.png");
        digit3.scale = 2.0f;
        digit3.x = -159.7772f + 140;
        digit3.y = Futile.screen.halfHeight - 57;
        Futile.stage.AddChild(digit3);

        hsDigit1 = new FSprite("0.png");
        hsDigit1.scale = 2.0f;
        hsDigit1.x = -159.7772f + 180;
        hsDigit1.y = Futile.screen.halfHeight - 123;
        hsDigit1.isVisible = false;
        Futile.stage.AddChild(hsDigit1);

        hsDigit2 = new FSprite("0.png");
        hsDigit2.scale = 2.0f;
        hsDigit2.x = -159.7772f + 160;
        hsDigit2.y = Futile.screen.halfHeight - 123;
        hsDigit2.isVisible = false;
        Futile.stage.AddChild(hsDigit2);

        hsDigit3 = new FSprite("0.png");
        hsDigit3.scale = 2.0f;
        hsDigit3.x = -159.7772f + 140;
        hsDigit3.y = Futile.screen.halfHeight - 123;
        hsDigit3.isVisible = false;
        Futile.stage.AddChild(hsDigit3);

        flash = new FSprite("GameOverAnim0.png");
        flash.scale = 2.0f;
        flash.x = 0;
        flash.isVisible = false;
        Futile.stage.AddChild(flash);

        btnPlay = new FButton("PlayButton.png");
        btnPlay.x = 0;
        btnPlay.y = 0;
        btnPlay.scale = 2.0f;
        Futile.stage.AddChild(btnPlay);

        btnInstructions.SignalRelease += HandleInfoButtonRelease;
        btnGameCenter.SignalRelease += HandleGCButtonRelease;
        btnPlay.SignalRelease += HandlePlayButtonRelease;

        Futile.instance.SignalUpdate += HandleUpdate;

        //score things
        if (InitScript.hsD1 == 0)
            hsDigit1.SetElementByName("0.png");
        else if (InitScript.hsD1 == 1)
            hsDigit1.SetElementByName("1.png");
        else if (InitScript.hsD1 == 2)
            hsDigit1.SetElementByName("2.png");
        else if (InitScript.hsD1 == 3)
            hsDigit1.SetElementByName("3.png");
        else if (InitScript.hsD1 == 4)
            hsDigit1.SetElementByName("4.png");
        else if (InitScript.hsD1 == 5)
            hsDigit1.SetElementByName("5.png");
        else if (InitScript.hsD1 == 6)
            hsDigit1.SetElementByName("6.png");
        else if (InitScript.hsD1 == 7)
            hsDigit1.SetElementByName("7.png");
        else if (InitScript.hsD1 == 8)
            hsDigit1.SetElementByName("8.png");
        else if (InitScript.hsD1 == 9)
            hsDigit1.SetElementByName("9.png");

                    //the second value
        if (InitScript.hsD2 == 0)
            hsDigit2.SetElementByName("0.png");
        else if (InitScript.hsD2 == 1)
            hsDigit2.SetElementByName("1.png");
        else if (InitScript.hsD2 == 2)
            hsDigit2.SetElementByName("2.png");
        else if (InitScript.hsD2 == 3)
            hsDigit2.SetElementByName("3.png");
        else if (InitScript.hsD2 == 4)
            hsDigit2.SetElementByName("4.png");
        else if (InitScript.hsD2 == 5)
            hsDigit2.SetElementByName("5.png");
        else if (InitScript.hsD2 == 6)
            hsDigit2.SetElementByName("6.png");
        else if (InitScript.hsD2 == 7)
            hsDigit2.SetElementByName("7.png");
        else if (InitScript.hsD2 == 8)
            hsDigit2.SetElementByName("8.png");
        else if (InitScript.hsD2 == 9)
            hsDigit2.SetElementByName("9.png");

        //the third digit
        if (InitScript.hsD3 == 0)
            hsDigit3.SetElementByName("0.png");
        else if (InitScript.hsD3 == 1)
            hsDigit3.SetElementByName("1.png");
        else if (InitScript.hsD3 == 2)
            hsDigit3.SetElementByName("2.png");
        else if (InitScript.hsD3 == 3)
            hsDigit3.SetElementByName("3.png");
        else if (InitScript.hsD3 == 4)
            hsDigit3.SetElementByName("4.png");
        else if (InitScript.hsD3 == 5)
            hsDigit3.SetElementByName("5.png");
        else if (InitScript.hsD3 == 6)
            hsDigit3.SetElementByName("6.png");
        else if (InitScript.hsD3 == 7)
            hsDigit3.SetElementByName("7.png");
        else if (InitScript.hsD3 == 8)
            hsDigit3.SetElementByName("8.png");
        else if (InitScript.hsD3 == 9)
            hsDigit3.SetElementByName("9.png");

        //non highscores
        if (InitScript.oldD1 == 0)
            digit1.SetElementByName("0.png");
        else if (InitScript.oldD1 == 1)
            digit1.SetElementByName("1.png");
        else if (InitScript.oldD1 == 2)
            digit1.SetElementByName("2.png");
        else if (InitScript.oldD1 == 3)
            digit1.SetElementByName("3.png");
        else if (InitScript.oldD1 == 4)
            digit1.SetElementByName("4.png");
        else if (InitScript.oldD1 == 5)
            digit1.SetElementByName("5.png");
        else if (InitScript.oldD1 == 6)
            digit1.SetElementByName("6.png");
        else if (InitScript.oldD1 == 7)
            digit1.SetElementByName("7.png");
        else if (InitScript.oldD1 == 8)
            digit1.SetElementByName("8.png");
        else if (InitScript.oldD1 == 9)
            digit1.SetElementByName("9.png");

        if (InitScript.oldD2 == 0)
            digit2.SetElementByName("0.png");
        else if (InitScript.oldD2 == 1)
            digit2.SetElementByName("1.png");
        else if (InitScript.oldD2 == 2)
            digit2.SetElementByName("2.png");
        else if (InitScript.oldD2 == 3)
            digit2.SetElementByName("3.png");
        else if (InitScript.oldD2 == 4)
            digit2.SetElementByName("4.png");
        else if (InitScript.oldD2 == 5)
            digit2.SetElementByName("5.png");
        else if (InitScript.oldD2 == 6)
            digit2.SetElementByName("6.png");
        else if (InitScript.oldD2 == 7)
            digit2.SetElementByName("7.png");
        else if (InitScript.oldD2 == 8)
            digit2.SetElementByName("8.png");
        else if (InitScript.oldD2 == 9)
            digit2.SetElementByName("9.png");

        if (InitScript.oldD3 == 0)
            digit3.SetElementByName("0.png");
        else if (InitScript.oldD3 == 1)
            digit3.SetElementByName("1.png");
        else if (InitScript.oldD3 == 2)
            digit3.SetElementByName("2.png");
        else if (InitScript.oldD3 == 3)
            digit3.SetElementByName("3.png");
        else if (InitScript.oldD3 == 4)
            digit3.SetElementByName("4.png");
        else if (InitScript.oldD3 == 5)
            digit3.SetElementByName("5.png");
        else if (InitScript.oldD3 == 6)
            digit3.SetElementByName("6.png");
        else if (InitScript.oldD3 == 7)
            digit3.SetElementByName("7.png");
        else if (InitScript.oldD3 == 8)
            digit3.SetElementByName("8.png");
        else if (InitScript.oldD3 == 9)
            digit3.SetElementByName("9.png");

        InitScript.blackBar1.MoveToTop();
        InitScript.blackBar2.MoveToTop();
    }
Esempio n. 5
0
    void Start()
    {
        instance = this;

        Go.defaultEaseType = EaseType.Linear;
        Go.duplicatePropertyRule = DuplicatePropertyRuleType.RemoveRunningProperty;

        bool isIPad = SystemInfo.deviceModel.Contains("iPad");

        FutileParams fparams = new FutileParams(false, false, true, false);

        fparams.AddResolutionLevel(480.0f, 1.0f, 1.0f,"");

        fparams.origin = new Vector2(0.5f, 0.5f);

        fparams.targetFrameRate = 60;
        Application.targetFrameRate = 60;

        Futile.instance.Init(fparams);

        Futile.atlasManager.LoadAtlas("Atlases/Sprites");

        FTouchManager.shouldMouseEmulateTouch = true;

        _stage = Futile.stage;

        //I have to say, unity makes it mad easy to store stuff like highscores on the device
        highScore = PlayerPrefs.GetInt("highscore", 0);
        hsD1 = PlayerPrefs.GetInt("Digit1",0);
        hsD2 = PlayerPrefs.GetInt("Digit2",0);
        hsD3 = PlayerPrefs.GetInt("Digit3",0);

        //the black bars are added to the ipad version only, since it's pixel art
        //it doesn't scale in odd resolutions, so I just made the screen a better resolution essentially

        //it's a pretty horrible hack, but this is the only way I could really think to do it
        blackBar1 = new FSprite("blackbar.png");
        if (isIPad == false)
            blackBar1.SetElementByName("0.png");
        blackBar1.x = -320;
        blackBar1.scale = 2.0f;
        Futile.stage.AddChild(blackBar1);
        blackBar2 = new FSprite("blackbar.png");
        if (isIPad == false)
            blackBar2.SetElementByName("0.png");
        blackBar2.x = 320;
        blackBar2.scale = 2.0f;
        Futile.stage.AddChild(blackBar2);

        HandleResize();
        ISoundManager.Start();
        ISoundManager.PlayMusic();

        //gamecenter stuff that unity reduces to like 3 lines
        //very cool
        Social.localUser.Authenticate(authCallback);

        gotoMenu();
    }