Пример #1
0
 public static WorldLevelButton CreateSolved(int worldNumber, int levelNumber, int stars)
 {
     Texture2D buttonTexture = LocksGame.ActiveScreen.LoadTexture ("WorldLevelSolved_" + (worldNumber + 1).ToString());
     Sunfish.Views.Sprite buttonSprite = new Sunfish.Views.Sprite (buttonTexture, new Vector2 (0, 0), Sunfish.Constants.ViewLayer.Layer1);
     WorldLevelButton button = new WorldLevelButton (buttonSprite, Stars.Create (stars, Sunfish.Constants.ViewLayer.Layer1), worldNumber, levelNumber);
     return button;
 }
Пример #2
0
        private void CreateWorldsContainer()
        {
            Sunfish.Views.Sprite world0Title = new Sunfish.Views.Sprite (LoadTexture ("World0Title"));
            Sunfish.Views.Sprite world1Title = new Sunfish.Views.Sprite (LoadTexture ("World1Title"));
            Sunfish.Views.Sprite world2Title = new Sunfish.Views.Sprite (LoadTexture ("World2Title"));

            Sunfish.Views.Container world0LevelsContainer = new Sunfish.Views.Container (LoadTexture ("WorldLevelsContainer_1"), Sunfish.Constants.ViewContainerLayout.FloatLeft);
            Sunfish.Views.Container world1LevelsContainer = new Sunfish.Views.Container (LoadTexture ("WorldLevelsContainer_2"), Sunfish.Constants.ViewContainerLayout.FloatLeft);
            Sunfish.Views.Container world2LevelsContainer = new Sunfish.Views.Container (LoadTexture ("WorldLevelsContainer_3"), Sunfish.Constants.ViewContainerLayout.FloatLeft);

            Sunfish.Views.Container world0Container = new Sunfish.Views.Container (Math.Max(world0Title.Width, world0LevelsContainer.Width), 0, Sunfish.Constants.ViewContainerLayout.StackCentered);
            world0Container.ShouldExpandHeight = true;
            Sunfish.Views.Container world1Container = new Sunfish.Views.Container (Math.Max(world1Title.Width, world1LevelsContainer.Width), 0, Sunfish.Constants.ViewContainerLayout.StackCentered);
            world1Container.ShouldExpandHeight = true;
            Sunfish.Views.Container world2Container = new Sunfish.Views.Container (Math.Max(world2Title.Width, world2LevelsContainer.Width), 0, Sunfish.Constants.ViewContainerLayout.StackCentered);
            world2Container.ShouldExpandHeight = true;

            PopulateWorldContainer (world0LevelsContainer, 0);
            PopulateWorldContainer (world1LevelsContainer, 1);
            PopulateWorldContainer (world2LevelsContainer, 2);

            world0Container.AddChild (world0Title);
            world0Container.AddChild (world0LevelsContainer, 0, PixelsWithDensity(20));
            world1Container.AddChild (world1Title);
            world1Container.AddChild (world1LevelsContainer, 0, PixelsWithDensity(20));
            world2Container.AddChild (world2Title);
            world2Container.AddChild (world2LevelsContainer, 0, PixelsWithDensity(20));

            Sunfish.Views.Container worldsContainer = new Sunfish.Views.Container (LocksGame.ScreenHeight, LocksGame.ScreenWidth, new Vector2 (0, PixelsWithDensity(140)), Sunfish.Constants.ViewContainerLayout.FloatLeft);
            worldsContainer.AddChild (world0Container, PixelsWithDensity(31), 0);
            worldsContainer.AddChild (world1Container, PixelsWithDensity(31), 0);
            worldsContainer.AddChild (world2Container, PixelsWithDensity(31), 0);

            AddChildView (worldsContainer);
        }
Пример #3
0
        private void CreateStartButtonAndPopup()
        {
            Sunfish.Views.Sprite startButtonGlow = new Sunfish.Views.Sprite (LoadTexture ("StartButtonGlow"), Sunfish.Constants.ViewLayer.Layer2);
            startButtonGlow.CenterInScreen ();
            startButtonGlow.OverlayColor = Color.TransparentBlack;
            startButtonGlow.StartEffect(new Sunfish.Views.Effects.InAndOut(10000d, 100, Color.White));
            AddChildView (startButtonGlow);

            Sunfish.Views.Sprite startButton = new Sunfish.Views.Sprite (LoadTexture ("StartButton"), Sunfish.Constants.ViewLayer.Layer3);
            startButton.CenterInScreen ();
            startButton.EnableTapGesture (HandleStartButtonTap);
            AddChildView (startButton);

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

            Models.GameProgress[] gameProgress = Rules.GameProgress.LoadGameProgress ();
            for (int slot=0; slot < Core.Constants.SlotsCount; slot++) {
                Models.GameProgress savedGame = gameProgress [slot];
                Views.PlaySlotButton playButton = null;
                if (savedGame == null) {
                    playButton = Views.PlaySlotButton.CreateNewGame (slot);
                } else {
                    playButton = Views.PlaySlotButton.CreateContinueGame (slot);
                }
                playButton.EnableTapGesture (HandleGameButtonTap);
                PlayPopup.AddChild (playButton, 0, (slot == 0) ? PixelsWithDensity (80) : PixelsWithDensity (30));
            }
        }
Пример #4
0
        public SettingsPopup()
            : base(LocksGame.ActiveScreen.LoadTexture ("PopupBackground"), Sunfish.Constants.ViewContainerLayout.StackCentered)
        {
            TransitionAudioFilename = "PopupTransition";
            TransitionAudioVolume = 0.8f;

            Sunfish.Views.Sprite soundEffectsLabel = new Sunfish.Views.Sprite (LocksGame.ActiveScreen.LoadTexture ("SoundEffectsLabel"), Sunfish.Constants.ViewLayer.Modal);
            if (LocksGame.SoundEffectsOn) {
                SoundEffectsCheckBox = Sunfish.Views.Switch.CreateOn (LocksGame.ActiveScreen.LoadTexture ("CheckBoxOn"), LocksGame.ActiveScreen.LoadTexture ("CheckBoxOff"), Sunfish.Constants.ViewLayer.Modal, HandleSoundEffectsCheckboxTapped);
            } else {
                SoundEffectsCheckBox = Sunfish.Views.Switch.CreateOff (LocksGame.ActiveScreen.LoadTexture ("CheckBoxOn"), LocksGame.ActiveScreen.LoadTexture ("CheckBoxOff"), Sunfish.Constants.ViewLayer.Modal, HandleSoundEffectsCheckboxTapped);
            }
            Sunfish.Views.Container soundEffectsContainer = new Sunfish.Views.Container (soundEffectsLabel.Width + SoundEffectsCheckBox.Width, soundEffectsLabel.Height, Sunfish.Constants.ViewLayer.Modal, Sunfish.Constants.ViewContainerLayout.FloatLeft);
            soundEffectsContainer.AddChild (SoundEffectsCheckBox);
            soundEffectsContainer.AddChild (soundEffectsLabel);

            Sunfish.Views.Sprite musicLabel = new Sunfish.Views.Sprite (LocksGame.ActiveScreen.LoadTexture ("MusicLabel"), Sunfish.Constants.ViewLayer.Modal);
            if (LocksGame.MusicOn) {
                MusicCheckBox = Sunfish.Views.Switch.CreateOn (LocksGame.ActiveScreen.LoadTexture ("CheckBoxOn"), LocksGame.ActiveScreen.LoadTexture ("CheckBoxOff"), Sunfish.Constants.ViewLayer.Modal, HandleMusicCheckboxTapped);
            } else {
                MusicCheckBox = Sunfish.Views.Switch.CreateOff (LocksGame.ActiveScreen.LoadTexture ("CheckBoxOn"), LocksGame.ActiveScreen.LoadTexture ("CheckBoxOff"), Sunfish.Constants.ViewLayer.Modal, HandleMusicCheckboxTapped);
            }
            Sunfish.Views.Container musicContainer = new Sunfish.Views.Container (musicLabel.Width + MusicCheckBox.Width, musicLabel.Height, Sunfish.Constants.ViewLayer.Modal, Sunfish.Constants.ViewContainerLayout.FloatLeft);
            musicContainer.AddChild (MusicCheckBox);
            musicContainer.AddChild (musicLabel);

            Sunfish.Views.Sprite closeButton = new Sunfish.Views.Sprite (LocksGame.ActiveScreen.LoadTexture ("CloseButton"), Sunfish.Constants.ViewLayer.Modal);
            closeButton.EnableTapGesture (HandleCloseButtonTap);

            AddChild (soundEffectsContainer, 0, PixelsWithDensity(80));
            AddChild (musicContainer, 0, PixelsWithDensity(15));
            AddChild (closeButton, 0, PixelsWithDensity(50));
        }
Пример #5
0
 public static WorldLevelButton CreateFirstUnsolved(int worldNumber, int levelNumber)
 {
     Texture2D buttonTexture = LocksGame.ActiveScreen.LoadTexture ("WorldLevelFirstUnsovled_" + (worldNumber + 1).ToString());
     Sunfish.Views.Sprite buttonSprite = new Sunfish.Views.Sprite (buttonTexture, new Vector2 (0, 0), Sunfish.Constants.ViewLayer.Layer1);
     WorldLevelButton button = new WorldLevelButton (buttonSprite, Stars.Create (0, Sunfish.Constants.ViewLayer.Layer1), worldNumber, levelNumber);
     buttonSprite.StartEffect (new Sunfish.Views.Effects.Pulsate (1200d, 1000, Color.White));
     return button;
 }
Пример #6
0
        private void CreateCreditsPopup()
        {
            Sunfish.Views.Sprite closeButton = new Sunfish.Views.Sprite (LocksGame.ActiveScreen.LoadTexture ("CloseButton"), Sunfish.Constants.ViewLayer.Modal);
            closeButton.EnableTapGesture (HandleCreditsPopupCloseButtonTap);

            CreditsPopup = AddPopup (LoadTexture ("PopupBackground"), Sunfish.Constants.ViewContainerLayout.StackCentered);
            CreditsPopup.AddChild (closeButton, 0, PixelsWithDensity (100));
        }
Пример #7
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 ();
        }
Пример #8
0
        public TutorialPopup()
            : base(LocksGame.ActiveScreen.LoadTexture("TutorialPopupBackground"), Sunfish.Constants.ViewContainerLayout.StackCentered)
        {
            Visible = false;

            TransitionAudioFilename = "PopupTransition";
            TransitionAudioVolume = 0.8f;

            TutorialContent = new Sunfish.Views.Sprite(LocksGame.ActiveScreen.LoadTexture("TutorialContent"), Sunfish.Constants.ViewLayer.Modal);
            AddChild (TutorialContent, 0, PixelsWithDensity (150));

            CloseButton = new Sunfish.Views.Sprite (LocksGame.ActiveScreen.LoadTexture ("CloseButton"), Sunfish.Constants.ViewLayer.Modal);
            CloseButton.EnableTapGesture(HandleCloseButtonTapped);
            AddChild (CloseButton, 0, PixelsWithDensity (50));
        }