Beispiel #1
0
        public UIDialogResult CheckHit(int x, int y)
        {
            UIDialogResult code = UIDialogResult.None;

            switch (Type)
            {
            case UIDialogType.Confirm:
                if (btnYes.CheckHit(x, y))
                {
                    code = UIDialogResult.Yes;
                }
                else if (btnNo.CheckHit(x, y))
                {
                    code = UIDialogResult.No;
                }
                btnYes.Visible = btnNo.Visible = false;
                break;

            case UIDialogType.Message:
                if (btnOk.CheckHit(x, y))
                {
                    code = UIDialogResult.Ok;
                }
                btnOk.Visible = false;
                break;
            }

            return(code);
        }
Beispiel #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;
            }
        }
        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;
            }
        }