Ejemplo n.º 1
0
        protected override void pointerPressed(int x, int y)
        {
            if (uiDialog.Visible)
            {
                uiDialog.TestHit(x, y);
                return;
            }

#if !WP7
            if (!Main.IsPremium && recVersion.Contains(x, y))
            {
                uiDialog.Title       = Localize.Instance.Disclaimer;
                uiDialog.Content     = Localize.Instance.DisclaimerDescription;
                uiDialog.CommandCode = COMMAND_BUY;
                uiDialog.FadeIn(UIDialogType.Message);
                return;
            }
#endif
        }
Ejemplo n.º 2
0
        public void CheckHit(int x, int y)
        {
            if (confirmDialog.Visible)
            {
                UIDialogResult resultCode = confirmDialog.CheckHit(x, y);
                if (resultCode == UIDialogResult.None)
                {
                    return;
                }
                if (resultCode == UIDialogResult.Yes)
                {
                    _scheduledCommand = confirmDialog.CommandCode;
                    SlideDown();
                }
                confirmDialog.FadeOut();
                return;
            }

            _scheduledCommand = COMMAND_NONE;
            btnReset.Active   = btnSolution.Active = btnAbandon.Active = btnMain.Active = false;
            if (_state != QuickMenuState.Show)
            {
                return;
            }

            if (recMusic.Contains(x, y))
            {
                SoundController.GetInstance().ToggleMusic();
                return;
            }

            if (recSound.Contains(x, y))
            {
                SoundController.GetInstance().ToggleSound();
                return;
            }

            if (btnReset.CheckHit(x, y))
            {
                _scheduledCommand = COMMAND_RESET;
                SlideDown();
                return;
            }
            if (btnSolution.CheckHit(x, y))
            {
                if (_parent.HintPoint - PlayScene.SOLUTION_COST < 0)
                {
                    confirmDialog.Title   = Localize.Instance.SolutionWarning;
                    confirmDialog.Content = string.Format(Localize.Instance.SolutionWarningDescription, _parent.HintPoint, PlayScene.SOLUTION_COST);
                    btnSolution.Active    = false;
                    confirmDialog.FadeIn(UIDialogType.Message);
                }
                else
                {
                    confirmDialog.Title       = Localize.Instance.SolutionConfirm;
                    confirmDialog.Content     = string.Format(Localize.Instance.SolutionConfirmDescription, _parent.HintPoint, PlayScene.SOLUTION_COST);
                    confirmDialog.CommandCode = COMMAND_SOLUTION;
                    confirmDialog.FadeIn(UIDialogType.Confirm);
                }
                return;
            }
            if (btnAbandon.CheckHit(x, y))
            {
                confirmDialog.Title       = Localize.Instance.AbandonConfirm;
                confirmDialog.Content     = Localize.Instance.AbandonConfirmDescription;
                confirmDialog.CommandCode = COMMAND_ABANDON;
                confirmDialog.FadeIn(UIDialogType.Confirm);
                return;
            }
            if (btnMain.CheckHit(x, y))
            {
                _scheduledCommand = COMMAND_MAIN;
                SlideDown();
                return;
            }
        }
Ejemplo n.º 3
0
        protected override void pointerReleased(int x, int y)
        {
            if (uiDialog.Visible)
            {
                UIDialogResult returnCode = uiDialog.CheckHit(x, y);
                if ((short)returnCode > -1)
                {
                    uiDialog.FadeOut();
                }
                return;
            }

            switch (State)
            {
            case LeaderboardState.Fill:
                if (State == LeaderboardState.Fill)
                {
                    btnSubmit.Active = false;
                    if (btnSubmit.CheckHit(x, y))
                    {
                        if (_username.Length < 3 || _username.Length > 14 || _username == DEFAULT_NAME)
                        {
                            uiDialog.Title   = Localize.Instance.InvalidName;
                            uiDialog.Content = Localize.Instance.InvalidNameDescription;
                            uiDialog.FadeIn(UIDialogType.Message);
                        }
                        else
                        {
                            State = LeaderboardState.Submit;
                            Leaderboard.SubmitScore(_score, _username, this);
                        }
                        return;
                    }
                }
                break;

            case LeaderboardState.View:
                if (leftTouching)
                {
                    if (vtView7.Y > 134 || view7Height < 340)
                    {
                        vTargetLeft = 134;
                    }
                    else if (vtView7.Y < 490 - view7Height)
                    {
                        vTargetLeft = 490 - view7Height;
                    }
                }
                else if (rightTouching)
                {
                    if (vtViewAll.Y > 134 || viewAllHeight < 340)
                    {
                        vTargetRight = 134;
                    }
                    else if (vtViewAll.Y < 490 - viewAllHeight)
                    {
                        vTargetRight = 490 - viewAllHeight;
                    }
                }
                leftTouching = rightTouching = false;
                break;
            }
        }
Ejemplo n.º 4
0
        private void performScheduledCommand()
        {
            switch (_commandScheduled)
            {
            case COMMAND_MAIN:
                for (int i = 0; i < menuItems.Length; i++)
                {
                    menuItems[i] = null;
                }
                switchFlag(FLAG_MAIN);
                break;

            case COMMAND_QUICKPLAY:
                bool firstPlay = SettingHelper.GetSetting <bool>(PlayScene.RECORD_FIRST_PLAY, true);
                if (firstPlay)
                {
                    confirmDialog.CommandCode = COMMAND_QUICKPLAY;
                    confirmDialog.Title       = Localize.Instance.PlayTutorial;
                    confirmDialog.Content     = Localize.Instance.PlayTutorialDescription;
                    confirmDialog.FadeIn(UIDialogType.Confirm);
                }
                else
                {
                    gameMode = GameMode.Classic;
                    switchState(MenuState.Game);
                }
                break;

            case COMMAND_ADVENTURE:
                gameMode = GameMode.Adventure;
                switchState(MenuState.Game);
                break;

            case COMMAND_LEADERBOARD:
                Main.Instance.GotoLeaderboard();
                break;

            case COMMAND_INSTRUCTION:
                for (int i = 0; i < menuItems.Length; i++)
                {
                    menuItems[i] = null;
                }
                switchFlag(FLAG_INSTRUCTION);
                break;

            case COMMAND_HOWTO:
                Main.Instance.GotoInstruction(texHowToPlay);
                break;

            case COMMAND_TUTORIAL:
                gameMode = GameMode.Tutorial;
                _returnMenuAfterTutorial = true;
                switchState(MenuState.Game);
                break;

            case COMMAND_ABOUT:
                Main.Instance.GotoInstruction(texCredits);
                break;

            case COMMAND_MOREAPP:
                for (int i = 0; i < menuItems.Length; i++)
                {
                    menuItems[i] = null;
                }
                switchFlag(FLAG_INSTRUCTION);
                break;

            case COMMAND_SPLASH:
                Main.Instance.GotoSplash(true);
                break;
            }
        }