Esempio n. 1
0
        //---------------------------------------------------------------------------------------------------------
        // ContinueGame - Used in menu selection
        //---------------------------------------------------------------------------------------------------------
        // Transitions to GameLayer
        //---------------------------------------------------------------------------------------------------------
        void ContinueGame(object stuff = null)
        {
            var mainGame         = LevelLayer.CreateScene(Window, levels, currentPlayer);
            var transitionToGame = new CCTransitionFade(2.0f, mainGame);

            Director.ReplaceScene(transitionToGame);
        }
Esempio n. 2
0
        void StartLevel()
        {
            var levelScene        = LevelLayer.CreateScene(Window, levels, activePlayer);
            var transitionToLevel = new CCTransitionFade(3.0f, levelScene);

            Director.ReplaceScene(transitionToLevel);
        }
Esempio n. 3
0
        void RetryLevel(object stuff = null)
        {
            var level            = LevelLayer.CreateScene(Window, levels, activePlayer);
            var transitionToGame = new CCTransitionFade(2.0f, level);

            Director.ReplaceScene(transitionToGame);
        }
Esempio n. 4
0
        //---------------------------------------------------------------------------------------------------------
        // NewGame - Used in menu selection
        //---------------------------------------------------------------------------------------------------------
        // Transitions to LevelLayer
        //---------------------------------------------------------------------------------------------------------
        void NewGame(object stuff = null)
        {
            if (currentPlayer.BranchProgression[1].LastLevelCompleted > -1)
            {
                //if (currentPlayer.LastLevelCompleted > -1) {
                CCRect bounds = VisibleBoundsWorldspace;

                PauseListeners(true);
                Application.Paused = true;

                var newGameLayer = new CCLayerColor(new CCColor4B(0, 0, 0, 230));
                AddChild(newGameLayer, 99999);

                // Add frame to layer
                frameSprite             = new CCSprite(uiSpriteSheet.Frames.Find(x => x.TextureFilename.Equals("frame.png")));
                frameSprite.AnchorPoint = CCPoint.AnchorMiddle;
                frameSprite.Position    = new CCPoint(bounds.Size.Width / 2, bounds.Size.Height / 2);
                newGameLayer.AddChild(frameSprite);

                newGameWarning                     = new CCLabel("This will erase your current progress!\n\n\nProceed?", GOTHIC_56_WHITE_FNT);
                newGameWarning.AnchorPoint         = CCPoint.AnchorMiddle;
                newGameWarning.Scale               = 1.5f;
                newGameWarning.Position            = new CCPoint(frameSprite.BoundingBox.Center);
                newGameWarning.HorizontalAlignment = CCTextAlignment.Center;
                newGameLayer.AddChild(newGameWarning);

                okLabel             = new CCLabel("OK", GOTHIC_44_HD_FNT);
                okLabel.AnchorPoint = CCPoint.AnchorMiddle;
                okLabel.Scale       = 1.5f;

                cancelLabel             = new CCLabel("Cancel", GOTHIC_44_HD_FNT);
                cancelLabel.AnchorPoint = CCPoint.AnchorMiddle;
                cancelLabel.Scale       = 1.5f;

                var okItem = new CCMenuItemLabel(okLabel, okSender => {
                    newGameLayer.RemoveFromParent();
                    ResumeListeners(true);
                    Application.Paused = false;

                    currentPlayer = new Player();
                    currentPlayer.WriteData(currentPlayer);

                    var mainGame         = LevelLayer.CreateScene(Window, levels, currentPlayer);
                    var transitionToGame = new CCTransitionFade(2.0f, mainGame);
                    Director.ReplaceScene(transitionToGame);
                });
                okItem.Position = bounds.Center;

                var cancelItem = new CCMenuItemLabel(cancelLabel, cancelSender => {
                    newGameLayer.RemoveFromParent();
                    ResumeListeners(true);
                    Application.Paused = false;
                });
                cancelItem.Position = bounds.Center;

                var closeMenu = new CCMenu(okItem, cancelItem);
                closeMenu.AlignItemsHorizontally(50);
                closeMenu.AnchorPoint = CCPoint.AnchorMiddleBottom;
                closeMenu.Position    = new CCPoint(bounds.Size.Width / 2, frameSprite.BoundingBox.MinY + (okLabel.BoundingBox.Size.Height * 2.5f));

                newGameLayer.AddChild(closeMenu);
            }
            else
            {
                var mainGame         = LevelLayer.CreateScene(Window, levels, currentPlayer);
                var transitionToGame = new CCTransitionFade(2.0f, mainGame);
                Director.ReplaceScene(transitionToGame);
            }
        }