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 (confirmDialog.Visible) { UIDialogResult returnCode = confirmDialog.CheckHit(x, y); if ((short)returnCode > -1) { confirmDialog.FadeOut(); switch (confirmDialog.CommandCode) { case COMMAND_QUICKPLAY: gameMode = (returnCode == UIDialogResult.Yes) ? GameMode.Tutorial : GameMode.Classic; _returnMenuAfterTutorial = false; switchState(MenuState.Game); break; case COMMAND_ADVENTURE: case COMMAND_LEADERBOARD: #if WINDOWS_PHONE if (returnCode == UIDialogResult.Yes) { MarketplaceReviewTask marketplace = new MarketplaceReviewTask(); marketplace.Show(); } #endif switchFlag(FLAG_MAIN); break; } } return; } if (recMusic.Contains(x, y)) { SoundController.GetInstance().ToggleMusic(); return; } if (recSound.Contains(x, y)) { SoundController.GetInstance().ToggleSound(); return; } if (_state != MenuState.Active) { return; } foreach (MenuItem menuItem in menuItems) { menuItem.Active = false; } _commandScheduled = COMMAND_NONE; switch (_flag) { case FLAG_MAIN: if (menuItems[0].CheckHit(x, y)) { _commandScheduled = COMMAND_QUICKPLAY; switchState(MenuState.FadeOut); return; } if (menuItems[1].CheckHit(x, y)) { _commandScheduled = COMMAND_ADVENTURE; switchState(MenuState.FadeOut); return; } if (menuItems[2].CheckHit(x, y)) { _commandScheduled = COMMAND_INSTRUCTION; switchState(MenuState.FadeOut); return; } if (menuItems[3].CheckHit(x, y)) { _commandScheduled = COMMAND_LEADERBOARD; switchState(MenuState.FadeOut); return; } break; case FLAG_INSTRUCTION: if (menuItems[0].CheckHit(x, y)) { _commandScheduled = COMMAND_HOWTO; switchState(MenuState.FadeOut); return; } if (menuItems[1].CheckHit(x, y)) { _commandScheduled = COMMAND_TUTORIAL; switchState(MenuState.FadeOut); return; } if (menuItems[2].CheckHit(x, y)) { _commandScheduled = COMMAND_ABOUT; switchState(MenuState.FadeOut); return; } if (menuItems[3].CheckHit(x, y)) { _commandScheduled = COMMAND_MOREAPP; switchState(MenuState.FadeOut); return; } break; } }
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; } }
protected override void pointerReleased(int x, int y) { if (uiDialog.Visible) { UIDialogResult returnCode = uiDialog.CheckHit(x, y); if ((short)returnCode > -1) { uiDialog.FadeOut(); switch (uiDialog.CommandCode) { case COMMAND_EXIT: if (returnCode == UIDialogResult.Yes) { #if ANDROID if (!Main.IsPremium) { (Main.Activity as MainActivity).DisplayAd(); } SettingHelper.SaveSetting(); Main.Instance.Exit(); #endif #if WINDOWS_PHONE && SILVERLIGHT SettingHelper.SaveSetting(); SoundController.GetInstance().FadeOut(); GamePage.Instance.GotoExitPage(); #endif #if WINDOWS || (WINDOWS_PHONE && !SILVERLIGHT) SettingHelper.SaveSetting(); Main.Instance.Exit(); #endif } break; case COMMAND_BUY: #if WP8 GamePage.Instance.RemoveAd(); #endif #if ANDROID (Main.Activity as MainActivity).RemoveAd(); #endif break; } } return; } if (recMusic.Contains(x, y)) { SoundController.GetInstance().ToggleMusic(); return; } if (recSound.Contains(x, y)) { SoundController.GetInstance().ToggleSound(); return; } if (_flag == FLAG_PRESS) { SwitchFlag(FLAG_MENU); } }