コード例 #1
0
        private async Task SelectTeam(TeamColor color)
        {
            await Task.Delay(500);

            var confirmDiag = new PoGoMessageDialog("Confirmation", $"Are you sure, you want {color}?")
            {
                AcceptText      = Utils.Resources.CodeResources.GetString("YesText"),
                CancelText      = Utils.Resources.CodeResources.GetString("NoText"),
                CoverBackground = true,
                AnimationType   = PoGoMessageDialogAnimation.Fade
            };

            confirmDiag.AcceptInvoked += async(sender, e) =>
            {
                var response = await GameClient.SetPlayerTeam(color);

                switch (response.Status)
                {
                case SetPlayerTeamResponse.Types.Status.Unset:
                    Logger.Write("SetPlayerTeam Unset", LogLevel.Warning);
                    break;

                case SetPlayerTeamResponse.Types.Status.Failure:
                    Logger.Write("SetPlayerTeam Failure", LogLevel.Error);
                    break;

                case SetPlayerTeamResponse.Types.Status.TeamAlreadySet:
                    Logger.Write("SetPlayerTeam TeamAlreadySet");
                    var d2 = new MessageDialog("Your team is already set!");
                    await d2.ShowAsync();

                    break;

                case SetPlayerTeamResponse.Types.Status.Success:
                    GameClient.PlayerProfile.Team = response.PlayerData.Team;
                    break;

                default:
                    break;
                }
            };

            confirmDiag.Show();
        }
コード例 #2
0
        private void AskAndUseLuckyEgg(ItemDataWrapper item)
        {
            if (!GameClient.IsXpBoostActive)
            {
                var dialog = new PoGoMessageDialog("", string.Format(Resources.CodeResources.GetString("ItemUseQuestionText"), Resources.Items.GetString(item.ItemId.ToString())));
                dialog.AcceptText      = Resources.CodeResources.GetString("YesText");
                dialog.CancelText      = Resources.CodeResources.GetString("CancelText");
                dialog.CoverBackground = true;
                dialog.AnimationType   = PoGoMessageDialogAnimation.Bottom;
                dialog.AcceptInvoked  += async(sender, e) =>
                {
                    // Send use request
                    var res = await GameClient.UseXpBoost(item.ItemId);

                    switch (res.Result)
                    {
                    case UseItemXpBoostResponse.Types.Result.Success:
                        AppliedItem appliedItem = res.AppliedItems.Item.FirstOrDefault <AppliedItem>();
                        GameClient.AppliedItems.Add(new AppliedItemWrapper(appliedItem));
                        ReturnToGameScreen.Execute();
                        break;

                    case UseItemXpBoostResponse.Types.Result.ErrorXpBoostAlreadyActive:
                        ReturnToGameScreen.Execute();
                        break;

                    case UseItemXpBoostResponse.Types.Result.ErrorInvalidItemType:
                    case UseItemXpBoostResponse.Types.Result.ErrorLocationUnset:
                    case UseItemXpBoostResponse.Types.Result.ErrorNoItemsRemaining:
                    case UseItemXpBoostResponse.Types.Result.Unset:
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                    }
                };

                dialog.Show();
            }
        }
コード例 #3
0
        private void AskAndUseIncense(ItemDataWrapper item)
        {
            if (!GameClient.IsIncenseActive)
            {
                var dialog = new PoGoMessageDialog("", string.Format(Resources.CodeResources.GetString("ItemUseQuestionText"), Resources.Items.GetString(item.ItemId.ToString())));
                dialog.AcceptText      = Resources.CodeResources.GetString("YesText");
                dialog.CancelText      = Resources.CodeResources.GetString("CancelText");
                dialog.CoverBackground = true;
                dialog.AnimationType   = PoGoMessageDialogAnimation.Bottom;
                dialog.AcceptInvoked  += async(sender, e) =>
                {
                    //// Send use request
                    var res = await GameClient.UseIncense(item.ItemId);

                    switch (res.Result)
                    {
                    case UseIncenseResponse.Types.Result.Success:
                        GameClient.AppliedItems.Add(new AppliedItemWrapper(res.AppliedIncense));
                        ReturnToGameScreen.Execute();
                        break;

                    case UseIncenseResponse.Types.Result.IncenseAlreadyActive:
                        ReturnToGameScreen.Execute();
                        break;

                    case UseIncenseResponse.Types.Result.LocationUnset:
                    case UseIncenseResponse.Types.Result.NoneInInventory:
                    case UseIncenseResponse.Types.Result.Unknown:
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                    }
                };

                dialog.Show();
            }
        }