Пример #1
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));
            }
        }
Пример #2
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;
 }