コード例 #1
0
        public void Accept(IQuest quest, Action <GooglePlayGames.BasicApi.Quests.QuestAcceptStatus, IQuest> callback)
        {
            Misc.CheckNotNull <IQuest>(quest);
            Misc.CheckNotNull <Action <GooglePlayGames.BasicApi.Quests.QuestAcceptStatus, IQuest> >(callback);
            callback = CallbackUtils.ToOnGameThread <GooglePlayGames.BasicApi.Quests.QuestAcceptStatus, IQuest>(callback);
            NativeQuest quest1 = quest as NativeQuest;

            if (quest1 == null)
            {
                Logger.e("Encountered quest that was not generated by this IQuestClient");
                callback(GooglePlayGames.BasicApi.Quests.QuestAcceptStatus.BadInput, (IQuest)null);
            }
            else
            {
                this.mManager.Accept(quest1, (Action <GooglePlayGames.Native.PInvoke.QuestManager.AcceptResponse>)(response =>
                {
                    if (response.RequestSucceeded())
                    {
                        callback(GooglePlayGames.BasicApi.Quests.QuestAcceptStatus.Success, (IQuest)response.AcceptedQuest());
                    }
                    else
                    {
                        callback(NativeQuestClient.FromAcceptStatus(response.ResponseStatus()), (IQuest)null);
                    }
                }));
            }
        }
コード例 #2
0
        public void ClaimMilestone(IQuestMilestone milestone, Action <GooglePlayGames.BasicApi.Quests.QuestClaimMilestoneStatus, IQuest, IQuestMilestone> callback)
        {
            Misc.CheckNotNull <IQuestMilestone>(milestone);
            Misc.CheckNotNull <Action <GooglePlayGames.BasicApi.Quests.QuestClaimMilestoneStatus, IQuest, IQuestMilestone> >(callback);
            callback = CallbackUtils.ToOnGameThread <GooglePlayGames.BasicApi.Quests.QuestClaimMilestoneStatus, IQuest, IQuestMilestone>(callback);
            NativeQuestMilestone milestone1 = milestone as NativeQuestMilestone;

            if (milestone1 == null)
            {
                Logger.e("Encountered milestone that was not generated by this IQuestClient");
                callback(GooglePlayGames.BasicApi.Quests.QuestClaimMilestoneStatus.BadInput, (IQuest)null, (IQuestMilestone)null);
            }
            else
            {
                this.mManager.ClaimMilestone(milestone1, (Action <GooglePlayGames.Native.PInvoke.QuestManager.ClaimMilestoneResponse>)(response =>
                {
                    if (response.RequestSucceeded())
                    {
                        callback(GooglePlayGames.BasicApi.Quests.QuestClaimMilestoneStatus.Success, (IQuest)response.Quest(), (IQuestMilestone)response.ClaimedMilestone());
                    }
                    else
                    {
                        callback(NativeQuestClient.FromClaimStatus(response.ResponseStatus()), (IQuest)null, (IQuestMilestone)null);
                    }
                }));
            }
        }
コード例 #3
0
 private static Action <GooglePlayGames.Native.PInvoke.QuestManager.QuestUIResponse> FromQuestUICallback(Action <QuestUiResult, IQuest, IQuestMilestone> callback)
 {
     return((Action <GooglePlayGames.Native.PInvoke.QuestManager.QuestUIResponse>)(response =>
     {
         if (!response.RequestSucceeded())
         {
             callback(NativeQuestClient.UiErrorToQuestUiResult(response.RequestStatus()), (IQuest)null, (IQuestMilestone)null);
         }
         else
         {
             NativeQuest nativeQuest = response.AcceptedQuest();
             NativeQuestMilestone claim = response.MilestoneToClaim();
             if (nativeQuest != null)
             {
                 callback(QuestUiResult.UserRequestsQuestAcceptance, (IQuest)nativeQuest, (IQuestMilestone)null);
                 claim.Dispose();
             }
             else if (claim != null)
             {
                 callback(QuestUiResult.UserRequestsMilestoneClaiming, (IQuest)null, (IQuestMilestone)response.MilestoneToClaim());
                 nativeQuest.Dispose();
             }
             else
             {
                 Logger.e("Quest UI succeeded without a quest acceptance or milestone claim.");
                 nativeQuest.Dispose();
                 claim.Dispose();
                 callback(QuestUiResult.InternalError, (IQuest)null, (IQuestMilestone)null);
             }
         }
     }));
 }
コード例 #4
0
        public void ShowSpecificQuestUI(IQuest quest, Action <QuestUiResult, IQuest, IQuestMilestone> callback)
        {
            Misc.CheckNotNull <IQuest>(quest);
            Misc.CheckNotNull <Action <QuestUiResult, IQuest, IQuestMilestone> >(callback);
            callback = CallbackUtils.ToOnGameThread <QuestUiResult, IQuest, IQuestMilestone>(callback);
            NativeQuest quest1 = quest as NativeQuest;

            if (quest1 == null)
            {
                Logger.e("Encountered quest that was not generated by this IQuestClient");
                callback(QuestUiResult.BadInput, (IQuest)null, (IQuestMilestone)null);
            }
            else
            {
                this.mManager.ShowQuestUI(quest1, NativeQuestClient.FromQuestUICallback(callback));
            }
        }
コード例 #5
0
 public void ShowAllQuestsUI(Action <QuestUiResult, IQuest, IQuestMilestone> callback)
 {
     Misc.CheckNotNull <Action <QuestUiResult, IQuest, IQuestMilestone> >(callback);
     callback = CallbackUtils.ToOnGameThread <QuestUiResult, IQuest, IQuestMilestone>(callback);
     this.mManager.ShowAllQuestUI(NativeQuestClient.FromQuestUICallback(callback));
 }