Esempio n. 1
0
        private void CreateSolvedPopup()
        {
            StarsView = Views.Stars.Create (0, Sunfish.Constants.ViewLayer.Modal);

            string initialTextForSizing = Model.IsLastLevel () ? "All Levels Complete!" : "Solved in 99 Turns";
            SolvedLabel = new Label (initialTextForSizing, LocksGame.GetTopBarFont (), Color.AntiqueWhite, Sunfish.Constants.ViewLayer.Modal);

            Sunfish.Views.Sprite nextLevelButton = null;
            if ( ! Model.IsLastLevel()) {
                nextLevelButton = new Sunfish.Views.Sprite (LoadTexture ("NextLevelButton"), Sunfish.Constants.ViewLayer.Modal);
                nextLevelButton.EnableTapGesture (HandleNextLevelButtonTapped);
            }

            Sunfish.Views.Sprite retryButton = new Sunfish.Views.Sprite (LoadTexture ("RetryButton"), Sunfish.Constants.ViewLayer.Modal);
            retryButton.EnableTapGesture (HandleRetryButtonTapped);

            Sunfish.Views.Sprite quitButton = new Sunfish.Views.Sprite (LoadTexture ("QuitGameButton"), Sunfish.Constants.ViewLayer.Modal);
            quitButton.EnableTapGesture (HandleQuitButtonFromSolvedPopupTapped);

            SolvedPopup = AddPopup (LoadTexture ("PopupBackground"), Sunfish.Constants.ViewContainerLayout.StackCentered);
            SolvedPopup.TransitionAudioVolume = 0.8f;

            /** Add solved popup children **/

            SolvedPopup.AddChild (StarsView, 0, PixelsWithDensity (Model.IsLastLevel() ? 60 : 35));
            SolvedPopup.AddChild (SolvedLabel, 0, PixelsWithDensity (12));
            if (nextLevelButton != null) {
                SolvedPopup.AddChild (nextLevelButton, 0, PixelsWithDensity (25));
            }
            SolvedPopup.AddChild (retryButton, 0, PixelsWithDensity (Model.IsLastLevel() ? 60 : 25));
            SolvedPopup.AddChild (quitButton, 0, PixelsWithDensity (25));
        }
Esempio n. 2
0
        private void CreateAndPopulateTopBar()
        {
            Sunfish.Views.Sprite pauseButton = new Sunfish.Views.Sprite (LoadTexture ("PauseButton"));
            pauseButton.EnableTapGesture (HandlePauseButtonTapped);

            Sunfish.Views.Sprite settingsButton = new Sunfish.Views.Sprite (LoadTexture ("SettingsButton"));
            settingsButton.EnableTapGesture (HandleSettingsButtonTapped);

            Sunfish.Views.Sprite tutorialButton = new Sunfish.Views.Sprite (LoadTexture ("TutorialButton"));
            tutorialButton.EnableTapGesture (HandleTutorialButtonTapped);

            Sunfish.Views.Sprite turnsIcon = new Sunfish.Views.Sprite (LoadTexture ("TopBarTurn"));
            TurnsLabel = new Sunfish.Views.Label ("0", LocksGame.GetTopBarFont (), Color.AntiqueWhite);
            UpdateTurnsLabel ();

            Sunfish.Views.Sprite gemIcon = new Sunfish.Views.Sprite (LoadTexture ("TopBarGem"));
            LockedCountLabel = new Sunfish.Views.Label ("0", LocksGame.GetTopBarFont (), Color.AntiqueWhite);
            UpdateLockCountLabel ();

            int levelNumberForLabel = (WorldNumber * Locks.Core.Constants.WorldLevelCount) + LevelNumber + 1;
            Sunfish.Views.Sprite levelIcon = new Sunfish.Views.Sprite (LoadTexture ("TopBarWorld" + (WorldNumber+1).ToString()));
            Sunfish.Views.Label levelLabel = new Sunfish.Views.Label ("Level " + levelNumberForLabel.ToString (), LocksGame.GetTopBarFont (), Color.AntiqueWhite);

            SettingsPopup = new Views.SettingsPopup ();
            AddChildView (SettingsPopup);

            GameCenterButton gameCenterButton = new GameCenterButton ();

            CreateTopBar ();
            TopBar.AddChild (pauseButton, PixelsWithDensity (10), PixelsWithDensity (10));
            TopBar.AddChild (settingsButton, PixelsWithDensity (10), PixelsWithDensity (10));
            TopBar.AddChild (tutorialButton, PixelsWithDensity (10), PixelsWithDensity (10));
            TopBar.AddChild (turnsIcon, PixelsWithDensity (70), PixelsWithDensity (25));
            TopBar.AddChild (TurnsLabel, PixelsWithDensity (5), PixelsWithDensity (20));
            TopBar.AddChild (gemIcon, PixelsWithDensity (70), PixelsWithDensity (25));
            TopBar.AddChild (LockedCountLabel, PixelsWithDensity (5), PixelsWithDensity (20));
            TopBar.AddChild (levelIcon, PixelsWithDensity (70), PixelsWithDensity (25));
            TopBar.AddChild (levelLabel, PixelsWithDensity (5), PixelsWithDensity (20));
            TopBar.AddChild (gameCenterButton);
            gameCenterButton.PositionInTopRight ();

            if (LevelNumber == 0 && WorldNumber == 0 && LocksGame.GameProgress.GetSolvedLevel (LevelNumber, WorldNumber) == null) {
                TutorialEmphasisArrow = new Sunfish.Views.Sprite (LoadTexture ("UpArrow"), Sunfish.Constants.ViewLayer.Layer5);
                Vector2 initialPosition = new Vector2 (tutorialButton.Position.X + PixelsWithDensity(10), tutorialButton.Position.Y + tutorialButton.Height + PixelsWithDensity (10));
                Vector2 finalPosition = new Vector2 (tutorialButton.Position.X + PixelsWithDensity(10), tutorialButton.Position.Y + tutorialButton.Height - PixelsWithDensity(10));
                TutorialEmphasisArrow.Position = initialPosition;
                TutorialEmphasisArrow.StartEffect(new Sunfish.Views.Effects.BackAndForth(initialPosition, finalPosition, 400d));
                TutorialEmphasisArrow.StartEffect (new Sunfish.Views.Effects.Pulsate (800d, 500, Color.Green));
                AddChildView (TutorialEmphasisArrow);
            }
        }