Esempio n. 1
0
        private void CreateAndPopulateTopBar()
        {
            Sunfish.Views.Sprite settingsButton = new Sunfish.Views.Sprite (LoadTexture ("SettingsButton"));
            settingsButton.EnableTapGesture (HandleSettingsButtonTap);
            SettingsPopup = new Views.SettingsPopup ();
            AddChildView (SettingsPopup);

            GameCenterButton gameCenterButton = new GameCenterButton ();

            CreateTopBar ();
            TopBar.AddChild (settingsButton, PixelsWithDensity (10), PixelsWithDensity (10));
            TopBar.AddChild (gameCenterButton);
            gameCenterButton.PositionInTopRight ();
        }
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);
            }
        }