コード例 #1
0
ファイル: StartLayer.cs プロジェクト: j-mathes/BubbleBreak
        //---------------------------------------------------------------------------------------------------------
        // PlayerDelete
        //---------------------------------------------------------------------------------------------------------
        // Deletes player information
        //---------------------------------------------------------------------------------------------------------
        void PlayerDelete(object stuff)
        {
            PauseListeners(true);
            Application.Paused = true;

            var playerResetLayer = new CCLayerColor(new CCColor4B(0, 0, 0, 230));

            AddChild(playerResetLayer, 99999);

            // Add frame to layer
            var 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);
            playerResetLayer.AddChild(frameSprite);

            string playerName       = string.Empty;
            var    sentMenuItem     = (CCMenuItemImage)stuff;
            var    playerSlotString = sentMenuItem.UserData.ToString();

            if (playerSlotString == "Slot1")
            {
                playerName = player1.Name;
            }
            else if (playerSlotString == "Slot2")
            {
                playerName = player1.Name;
            }
            else if (playerSlotString == "Slot3")
            {
                playerName = player1.Name;
            }

            var playerNameLabel = new CCLabel(playerName, GOTHIC_56_WHITE_HD_FNT);

            playerNameLabel.AnchorPoint         = CCPoint.AnchorMiddle;
            playerNameLabel.Scale               = 2;
            playerNameLabel.PositionX           = frameSprite.BoundingBox.Center.X;
            playerNameLabel.PositionY           = frameSprite.BoundingBox.MaxY - 200;
            playerNameLabel.HorizontalAlignment = CCTextAlignment.Center;
            playerResetLayer.AddChild(playerNameLabel);

            var 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;
            playerResetLayer.AddChild(newGameWarning);

            var okLabel = new CCLabel("OK", GOTHIC_44_HD_FNT);

            okLabel.AnchorPoint = CCPoint.AnchorMiddle;
            okLabel.Scale       = 1.5f;

            var cancelLabel = new CCLabel("Cancel", GOTHIC_44_HD_FNT);

            cancelLabel.AnchorPoint = CCPoint.AnchorMiddle;
            cancelLabel.Scale       = 1.5f;

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

                if (playerSlotString == "Slot1")
                {
                    player1 = new Player(PlayerSlot.slot1);
                    player1.WriteData(player1);
                }
                else if (playerSlotString == "Slot2")
                {
                    player2 = new Player(PlayerSlot.slot2);
                    player2.WriteData(player2);
                }
                else if (playerSlotString == "Slot3")
                {
                    player3 = new Player(PlayerSlot.slot3);
                    player3.WriteData(player3);
                }

                UpdateUI();
            });

            okItem.Position = bounds.Center;

            var cancelItem = new CCMenuItemLabel(cancelLabel, cancelSender => {
                playerResetLayer.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));

            playerResetLayer.AddChild(closeMenu);
        }
コード例 #2
0
ファイル: StartLayer.cs プロジェクト: j-mathes/BubbleBreak
        //---------------------------------------------------------------------------------------------------------
        // PlayerInfo
        //---------------------------------------------------------------------------------------------------------
        // Displays the player information popup
        // TODO: modify the information shown to match player class attributes
        //---------------------------------------------------------------------------------------------------------
        void PlayerInfo(object stuff)
        {
            Player currentPlayer;
            var    sentMenuItem     = (CCMenuItemImage)stuff;
            var    playerSlotString = sentMenuItem.UserData.ToString();

            if (playerSlotString == "Slot1")
            {
                currentPlayer = player1;
            }
            else if (playerSlotString == "Slot2")
            {
                currentPlayer = player2;
            }
            else if (playerSlotString == "Slot3")
            {
                currentPlayer = player3;
            }

            PauseListeners(true);
            Application.Paused = true;

            var playerStatsLayer = new CCLayerColor(new CCColor4B(0, 0, 0, 230));

            AddChild(playerStatsLayer, 99999);

            // Add frame to layer
            var 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);
            frameSprite.ScaleY      = 1.3f;
            playerStatsLayer.AddChild(frameSprite);

            var titleLabel = new CCLabel("Player Stats", GOTHIC_56_WHITE_HD_FNT)
            {
                AnchorPoint = CCPoint.AnchorMiddle,
                Scale       = 1f
            };
            var titleMenuItem   = new CCMenuItemLabel(titleLabel);
            var playerNameLabel = new CCLabel(string.Format("Player Name: {0}", currentPlayer.Name), GOTHIC_56_WHITE_FNT)
            {
                AnchorPoint = CCPoint.AnchorMiddle,
                Scale       = 1.0f
            };
            var playerNameMenuItem = new CCMenuItemLabel(playerNameLabel);
            //var lastLevelLabel = new CCLabel ((currentPlayer.LastLevelCompleted == -1) ?  "Last Level Completed: Not Started Yet" : string.Format ("Last Level Completed: {0}", currentPlayer.LastLevelCompleted), GOTHIC_56_WHITE_FNT) {
            // TODO: instead of last level competed, change to report next level to be played
            var lastLevelLabel = new CCLabel((currentPlayer.BranchProgression[1].BranchState == CompletionState.notStarted) ?  "Last Level Completed: Not Started Yet" : string.Format("Last Level Completed: {0}", currentPlayer.BranchProgression[1].LastLevelCompleted), GOTHIC_56_WHITE_FNT)
            {
                AnchorPoint = CCPoint.AnchorMiddle,
                Scale       = 1.0f
            };
            var lastLevelMenuItem = new CCMenuItemLabel(lastLevelLabel);
            var coinsLabel        = new CCLabel(string.Format("Coins: {0}", currentPlayer.Coins), GOTHIC_56_WHITE_FNT)
            {
                AnchorPoint = CCPoint.AnchorMiddle,
                Scale       = 1.0f
            };
            var coinsMenuItem  = new CCMenuItemLabel(coinsLabel);
            var highScoreLabel = new CCLabel(string.Format("High Score: {0}", currentPlayer.TotalScores), GOTHIC_56_WHITE_FNT)
            {
                AnchorPoint = CCPoint.AnchorMiddle,
                Scale       = 1.0f
            };
            var highScoreMenuItem = new CCMenuItemLabel(highScoreLabel);
            var tapStrengthLabel  = new CCLabel(string.Format("Tap Strength: {0}", currentPlayer.PersistentTapStrength), GOTHIC_56_WHITE_FNT)
            {
                AnchorPoint = CCPoint.AnchorMiddle,
                Scale       = 1.0f
            };
            var tapStrengthMenuItem       = new CCMenuItemLabel(tapStrengthLabel);
            var percentChanceNextSeqLabel = new CCLabel(string.Format("Next in Sequence Luck: {0}%", currentPlayer.ChanceToRollNextSeq), GOTHIC_56_WHITE_FNT)
            {
                AnchorPoint = CCPoint.AnchorMiddle,
                Scale       = 1.0f
            };
            var percentChanceNextSeqMenuItem = new CCMenuItemLabel(percentChanceNextSeqLabel);
            var percentChanceBonusLabel      = new CCLabel(string.Format("Bonus Bubble Luck: {0}%", currentPlayer.ChanceToRollBonus), GOTHIC_56_WHITE_FNT)
            {
                AnchorPoint = CCPoint.AnchorMiddle,
                Scale       = 1.0f
            };
            var percentChanceBonusMenuItem = new CCMenuItemLabel(percentChanceBonusLabel);

            var timeBonusLabel = new CCLabel(string.Format("Additional Level Time: {0} Seconds", currentPlayer.PersistentTimeBonus), GOTHIC_56_WHITE_FNT)
            {
                AnchorPoint = CCPoint.AnchorMiddle,
                Scale       = 1.0f
            };
            var timeBonusMenuItem = new CCMenuItemLabel(timeBonusLabel);

            var time2xBonusLabel = new CCLabel(string.Format("2x Bonus Timer Extra: {0} Seconds", currentPlayer.Persistent2xTimeBonus), GOTHIC_56_WHITE_FNT)
            {
                AnchorPoint = CCPoint.AnchorMiddle,
                Scale       = 1.0f
            };
            var time2xBonusMenuItem = new CCMenuItemLabel(time2xBonusLabel);

            var time3xBonusLabel = new CCLabel(string.Format("3x Bonus Timer Extra: {0} Seconds", currentPlayer.Persistent3xTimeBonus), GOTHIC_56_WHITE_FNT)
            {
                AnchorPoint = CCPoint.AnchorMiddle,
                Scale       = 1.0f
            };
            var time3xBonusMenuItem = new CCMenuItemLabel(time3xBonusLabel);

            var highlightNextAvailableLabel = new CCLabel("Highlight Next Sequence Bubble: " + ((currentPlayer.HighlightNextPurchased) ? "Yes" : "No"), GOTHIC_56_WHITE_FNT)
            {
                AnchorPoint = CCPoint.AnchorMiddle,
                Scale       = Scale = 1.0f
            };
            var highlightNextMenuItem = new CCMenuItemLabel(highlightNextAvailableLabel);

            var okButtonLabel = new CCLabel("OK", GOTHIC_30_HD_FNT)
            {
                AnchorPoint = AnchorPoint = CCPoint.AnchorMiddle,
                Scale       = 2.0f
            };
            var okButtonMenuItem = new CCMenuItemLabel(okButtonLabel, okSender => {
                playerStatsLayer.RemoveFromParent();
                ResumeListeners(true);
                Application.Paused = false;
            });

            var playerStatsMenu = new CCMenu(titleMenuItem, playerNameMenuItem, lastLevelMenuItem, coinsMenuItem, highScoreMenuItem, tapStrengthMenuItem, percentChanceNextSeqMenuItem, percentChanceBonusMenuItem,
                                             timeBonusMenuItem, time2xBonusMenuItem, time3xBonusMenuItem, highlightNextMenuItem, okButtonMenuItem);

            playerStatsMenu.AnchorPoint = CCPoint.AnchorMiddle;
            playerStatsMenu.Position    = new CCPoint(bounds.Size.Width / 2, bounds.Size.Height / 2);
            playerStatsMenu.AlignItemsVertically(40);

            playerStatsLayer.AddChild(playerStatsMenu);
        }
コード例 #3
0
        public override void OnEnter()
        {
            base.OnEnter();

            CCRect visibleBounds = VisibleBoundsWorldspace;
            var    origin        = Layer.VisibleBoundsWorldspace.Origin;
            var    size          = Layer.VisibleBoundsWorldspace.Size;

            var sprite1 = new TouchableSprite();
            var texture = CCTextureCache.SharedTextureCache.AddImage("Images/CyanSquare.png");

            sprite1.Texture  = texture;
            sprite1.Position = origin + new CCPoint(size.Width / 2, size.Height / 2) + new CCPoint(-80, 80);
            AddChild(sprite1, -10);

            var sprite2 = new TouchableSprite();

            texture          = CCTextureCache.SharedTextureCache.AddImage("Images/MagentaSquare.png");
            sprite2.Texture  = texture;
            sprite2.Position = origin + new CCPoint(size.Width / 2, size.Height / 2);
            AddChild(sprite2, -20);

            var sprite3 = new TouchableSprite();

            texture          = CCTextureCache.SharedTextureCache.AddImage("Images/YellowSquare.png");
            sprite3.Texture  = texture;
            sprite3.Position = CCPoint.Zero;
            sprite2.AddChild(sprite3, -1);

            CCMenuItemFont.FontSize = 20;
            CCMenuItemFont.FontName = "arial";

            var popup = new CCMenuItemFont("Popup", (sender) =>
            {
                this.PauseListeners(true);

                var colorLayer = new CCLayerColor(new CCColor4B(0, 0, 255, 100));
                AddChild(colorLayer, 99999);

                var closeItem = new CCMenuItemFont("close", (closeSender) =>
                {
                    colorLayer.RemoveFromParent();
                    this.ResumeListeners(true);
                });

                closeItem.Position = visibleBounds.Center;

                var closeMenu         = new CCMenu(closeItem);
                closeMenu.AnchorPoint = CCPoint.AnchorLowerLeft;
                closeMenu.Position    = CCPoint.Zero;

                colorLayer.AddChild(closeMenu);
            });

            popup.AnchorPoint = CCPoint.AnchorMiddleRight;
            popup.Position    = new CCPoint(visibleBounds.Origin.X + visibleBounds.Size.Width,
                                            visibleBounds.Origin.Y + visibleBounds.Size.Height / 2);

            var menu = new CCMenu(popup);

            menu.AnchorPoint = CCPoint.AnchorLowerLeft;
            menu.Position    = CCPoint.Zero;

            AddChild(menu);
        }
コード例 #4
0
        //---------------------------------------------------------------------------------------------------------
        // AddedToScene
        //---------------------------------------------------------------------------------------------------------
        //
        protected override void AddedToScene()
        {
            base.AddedToScene();

            // Use the bounds to layout the positioning of our drawable assets
            CCRect bounds = VisibleBoundsWorldspace;

            Bubbles = new CCNode();
            AddChild(Bubbles);

            //initialize every bool in BubbleArray to false.  True if there is a bubble there.
            for (int i = 0; i < MAX_BUBBLES_X; i++)
            {
                BubbleOccupiedArray [i] = false;
            }

            branches = ReadBranches(branchInfo);
            levels   = ReadLevels(levelInfo);

            currentPlayer = new Player();


            if (File.Exists(currentPlayer.PlayerDataFile))
            {
                currentPlayer = Player.ReadData(currentPlayer);
            }
            else
            {
                currentPlayer.WriteData(currentPlayer);
            }

            // options popup
            optionsStd             = new CCSprite(uiSpriteSheet.Frames.Find(x => x.TextureFilename.Equals("gear_std.png")));
            optionsStd.AnchorPoint = CCPoint.AnchorMiddle;
            optionsSel             = new CCSprite(uiSpriteSheet.Frames.Find(x => x.TextureFilename.Equals("gear_sel.png")));
            optionsSel.AnchorPoint = CCPoint.AnchorMiddle;

            var optionPopup = new CCMenuItemImage(optionsStd, optionsSel, sender => {
                PauseListeners(true);
                Application.Paused = true;

                var optionsLayer = new CCLayerColor(new CCColor4B(0, 0, 0, 200));
                AddChild(optionsLayer, 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);
                optionsLayer.AddChild(frameSprite);

                var highlightOnLabel = new CCLabel("Highlight Next: On", GOTHIC_56_WHITE_FNT)
                {
                    AnchorPoint = CCPoint.AnchorMiddle,
                    Scale       = 2.0f
                };
                var highlightOffLabel = new CCLabel("Highlight Next: Off", GOTHIC_56_WHITE_FNT)
                {
                    AnchorPoint = CCPoint.AnchorMiddle,
                    Scale       = 2.0f
                };

                var highlightOnMenuItem  = new CCMenuItemLabel(highlightOnLabel);
                var highlightOffMenuItem = new CCMenuItemLabel(highlightOffLabel);

                highlightToggleMenuItem               = new CCMenuItemToggle(ToggleHighlight, highlightOnMenuItem, highlightOffMenuItem);
                highlightToggleMenuItem.Enabled       = currentPlayer.HighlightNextPurchased;
                highlightToggleMenuItem.PositionX     = frameSprite.BoundingBox.MidX;
                highlightToggleMenuItem.PositionY     = frameSprite.BoundingBox.MinY + (highlightToggleMenuItem.BoundingBox.Size.Height * 10f);
                highlightToggleMenuItem.SelectedIndex = (currentPlayer.IsHighlightNextActive) ? 0 : 1;

                var optionMenu         = new CCMenu(highlightToggleMenuItem);
                optionMenu.AnchorPoint = CCPoint.AnchorMiddleBottom;
                optionMenu.Position    = CCPoint.Zero;
                optionsLayer.AddChild(optionMenu);

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

                var closeItem = new CCMenuItemLabel(okLabel, closeSender => {
                    optionsLayer.RemoveFromParent();
                    ResumeListeners(true);
                    Application.Paused = false;
                });

                closeItem.PositionX = frameSprite.BoundingBox.MidX;
                closeItem.PositionY = frameSprite.BoundingBox.MinY + (closeItem.BoundingBox.Size.Height * 1.5f);

                var closeMenu         = new CCMenu(closeItem);
                closeMenu.AnchorPoint = CCPoint.AnchorMiddleBottom;
                closeMenu.Position    = CCPoint.Zero;

                optionsLayer.AddChild(closeMenu);
            });

            optionPopup.AnchorPoint = CCPoint.AnchorMiddle;
            optionPopup.Position    = new CCPoint(bounds.Size.Width / 10, bounds.Size.Height / 14);

            var optionItemsMenu = new CCMenu(optionPopup);

            optionItemsMenu.AnchorPoint = CCPoint.AnchorLowerLeft;
            optionItemsMenu.Position    = CCPoint.Zero;

            AddChild(optionItemsMenu);

            //---------------------------------------------------------------------------------------------------------
            //Menu Elements
            //---------------------------------------------------------------------------------------------------------

            newGameLabel             = new CCLabel("New Game", GOTHIC_44_HD_FNT);
            newGameLabel.AnchorPoint = CCPoint.AnchorMiddle;
            newGameLabel.Scale       = 2.0f;
            var menuItemNewGame = new CCMenuItemLabel(newGameLabel, NewGame);

            continueGameLabel             = new CCLabel("Continue", GOTHIC_44_HD_FNT);
            continueGameLabel.AnchorPoint = CCPoint.AnchorMiddle;
            continueGameLabel.Scale       = 2.0f;
            var menuItemContinueGame = new CCMenuItemLabel(continueGameLabel, ContinueGame);

            playerStatsLabel             = new CCLabel("Player Stats", GOTHIC_44_HD_FNT);
            playerStatsLabel.AnchorPoint = CCPoint.AnchorMiddle;
            playerStatsLabel.Scale       = 2.0f;
            var menuItemPlayerStats = new CCMenuItemLabel(playerStatsLabel, PlayerStats);

            shopLabel             = new CCLabel("Shop", GOTHIC_44_HD_FNT);
            shopLabel.AnchorPoint = CCPoint.AnchorMiddle;
            shopLabel.Scale       = 2.0f;
            var menuItemShop = new CCMenuItemLabel(shopLabel, Shop);

            var menu = new CCMenu(menuItemNewGame, menuItemContinueGame, menuItemPlayerStats, menuItemShop)
            {
                Position    = new CCPoint(bounds.Size.Width / 2, bounds.Size.Height / 2),
                AnchorPoint = CCPoint.AnchorMiddle
            };

            menu.AlignItemsVertically(150);

            AddChild(menu);

            rtLogo             = new CCSprite(uiSpriteSheet.Frames.Find(x => x.TextureFilename.Equals("bb_retrotek.png")));
            rtLogo.AnchorPoint = CCPoint.AnchorMiddle;
            rtLogo.Position    = new CCPoint(bounds.Size.Width / 2, bounds.Size.Height / 14);
            //rtLogo.RunAction (repeatedAction);
            AddChild(rtLogo);

            title             = new CCSprite(uiSpriteSheet.Frames.Find(x => x.TextureFilename.Equals("bb_title.png")));
            title.AnchorPoint = CCPoint.AnchorMiddle;
            title.Position    = new CCPoint(bounds.Size.Width / 2, (bounds.Size.Height / 7) * 6);
            title.RunAction(repeatedAction);
            AddChild(title);

            //if (currentPlayer.LastLevelCompleted < 0) {
            if (currentPlayer.BranchProgression[1].LastLevelCompleted < 0)
            {
                menuItemNewGame.Enabled      = true;
                menuItemContinueGame.Enabled = false;
                menuItemPlayerStats.Enabled  = false;
            }
            else
            {
                menuItemNewGame.Enabled      = true;
                menuItemContinueGame.Enabled = true;
                menuItemPlayerStats.Enabled  = true;
            }

            Schedule(_ => CheckForFadedBubbles());
        }
コード例 #5
0
        //---------------------------------------------------------------------------------------------------------
        // PlayerStats
        //---------------------------------------------------------------------------------------------------------
        // Show player information summary in a popup
        //---------------------------------------------------------------------------------------------------------
        void PlayerStats(object stuff = null)
        {
            CCRect bounds = VisibleBoundsWorldspace;

            PauseListeners(true);
            Application.Paused = true;

            var playerStatsLayer = new CCLayerColor(new CCColor4B(0, 0, 0, 230));

            AddChild(playerStatsLayer, 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);
            frameSprite.ScaleY      = 1.3f;
            playerStatsLayer.AddChild(frameSprite);

            var titleLabel = new CCLabel("Player Stats", GOTHIC_56_WHITE_HD_FNT)
            {
                AnchorPoint = CCPoint.AnchorMiddle,
                Scale       = 1f
            };
            var titleMenuItem   = new CCMenuItemLabel(titleLabel);
            var playerNameLabel = new CCLabel(string.Format("Player Name: {0}", currentPlayer.Name), GOTHIC_56_WHITE_FNT)
            {
                AnchorPoint = CCPoint.AnchorMiddle,
                Scale       = 1.0f
            };
            var playerNameMenuItem = new CCMenuItemLabel(playerNameLabel);
            //var lastLevelLabel = new CCLabel (string.Format ("Last Level Completed: {0}", currentPlayer.LastLevelCompleted), GOTHIC_56_WHITE_FNT) {
            var lastLevelLabel = new CCLabel(string.Format("Last Level Completed: {0}", currentPlayer.BranchProgression[1].LastLevelCompleted), GOTHIC_56_WHITE_FNT)
            {
                AnchorPoint = CCPoint.AnchorMiddle,
                Scale       = 1.0f
            };
            var lastLevelMenuItem = new CCMenuItemLabel(lastLevelLabel);
            var coinsLabel        = new CCLabel(string.Format("Coins: {0}", currentPlayer.Coins), GOTHIC_56_WHITE_FNT)
            {
                AnchorPoint = CCPoint.AnchorMiddle,
                Scale       = 1.0f
            };
            var coinsMenuItem  = new CCMenuItemLabel(coinsLabel);
            var highScoreLabel = new CCLabel(string.Format("High Score: {0}", currentPlayer.TotalScores), GOTHIC_56_WHITE_FNT)
            {
                AnchorPoint = CCPoint.AnchorMiddle,
                Scale       = 1.0f
            };
            var highScoreMenuItem = new CCMenuItemLabel(highScoreLabel);
            var tapStrengthLabel  = new CCLabel(string.Format("Tap Strength: {0}", currentPlayer.PersistentTapStrength), GOTHIC_56_WHITE_FNT)
            {
                AnchorPoint = CCPoint.AnchorMiddle,
                Scale       = 1.0f
            };
            var tapStrengthMenuItem       = new CCMenuItemLabel(tapStrengthLabel);
            var percentChanceNextSeqLabel = new CCLabel(string.Format("Next in Sequence Luck: {0}%", currentPlayer.ChanceToRollNextSeq), GOTHIC_56_WHITE_FNT)
            {
                AnchorPoint = CCPoint.AnchorMiddle,
                Scale       = 1.0f
            };
            var percentChanceNextSeqMenuItem = new CCMenuItemLabel(percentChanceNextSeqLabel);
            var percentChanceBonusLabel      = new CCLabel(string.Format("Bonus Bubble Luck: {0}%", currentPlayer.ChanceToRollBonus), GOTHIC_56_WHITE_FNT)
            {
                AnchorPoint = CCPoint.AnchorMiddle,
                Scale       = 1.0f
            };
            var percentChanceBonusMenuItem = new CCMenuItemLabel(percentChanceBonusLabel);

            var timeBonusLabel = new CCLabel(string.Format("Additional Level Time: {0} Seconds", currentPlayer.PersistentTimeBonus), GOTHIC_56_WHITE_FNT)
            {
                AnchorPoint = CCPoint.AnchorMiddle,
                Scale       = 1.0f
            };
            var timeBonusMenuItem = new CCMenuItemLabel(timeBonusLabel);

            var time2xBonusLabel = new CCLabel(string.Format("2x Bonus Timer Extra: {0} Seconds", currentPlayer.Persistent2xTimeBonus), GOTHIC_56_WHITE_FNT)
            {
                AnchorPoint = CCPoint.AnchorMiddle,
                Scale       = 1.0f
            };
            var time2xBonusMenuItem = new CCMenuItemLabel(time2xBonusLabel);

            var time3xBonusLabel = new CCLabel(string.Format("3x Bonus Timer Extra: {0} Seconds", currentPlayer.Persistent3xTimeBonus), GOTHIC_56_WHITE_FNT)
            {
                AnchorPoint = CCPoint.AnchorMiddle,
                Scale       = 1.0f
            };
            var time3xBonusMenuItem = new CCMenuItemLabel(time3xBonusLabel);

            var highlightNextAvailableLabel = new CCLabel("Highlight Next Sequence Bubble: " + ((currentPlayer.HighlightNextPurchased) ? "Yes" : "No"), GOTHIC_56_WHITE_FNT)
            {
                AnchorPoint = CCPoint.AnchorMiddle,
                Scale       = Scale = 1.0f
            };
            var highlightNextMenuItem = new CCMenuItemLabel(highlightNextAvailableLabel);

            var okButtonLabel = new CCLabel("OK", GOTHIC_30_HD_FNT)
            {
                AnchorPoint = AnchorPoint = CCPoint.AnchorMiddle,
                Scale       = 2.0f
            };
            var okButtonMenuItem = new CCMenuItemLabel(okButtonLabel, okSender => {
                playerStatsLayer.RemoveFromParent();
                ResumeListeners(true);
                Application.Paused = false;
            });

            var playerStatsMenu = new CCMenu(titleMenuItem, playerNameMenuItem, lastLevelMenuItem, coinsMenuItem, highScoreMenuItem, tapStrengthMenuItem, percentChanceNextSeqMenuItem, percentChanceBonusMenuItem,
                                             timeBonusMenuItem, time2xBonusMenuItem, time3xBonusMenuItem, highlightNextMenuItem, okButtonMenuItem);

            playerStatsMenu.AnchorPoint = CCPoint.AnchorMiddle;
            playerStatsMenu.Position    = new CCPoint(bounds.Size.Width / 2, bounds.Size.Height / 2);
            playerStatsMenu.AlignItemsVertically(40);

            playerStatsLayer.AddChild(playerStatsMenu);
        }
コード例 #6
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);
            }
        }