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