Esempio n. 1
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);
                    }
                }));
            }
        }
Esempio n. 2
0
        public void Accept(IQuest quest, Action <QuestAcceptStatus, IQuest> callback)
        {
            Misc.CheckNotNull(quest);
            Misc.CheckNotNull(callback);
            callback = CallbackUtils.ToOnGameThread(callback);
            NativeQuest nativeQuest = quest as NativeQuest;

            if (nativeQuest == null)
            {
                Logger.e("Encountered quest that was not generated by this IQuestClient");
                callback(QuestAcceptStatus.BadInput, null);
            }
            else
            {
                mManager.Accept(nativeQuest, delegate(GooglePlayGames.Native.PInvoke.QuestManager.AcceptResponse response)
                {
                    if (response.RequestSucceeded())
                    {
                        callback(QuestAcceptStatus.Success, response.AcceptedQuest());
                    }
                    else
                    {
                        callback(FromAcceptStatus(response.ResponseStatus()), null);
                    }
                });
            }
        }
Esempio n. 3
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);
                    }
                }));
            }
        }
Esempio n. 4
0
        public void Accept(IQuest quest, Action <QuestAcceptStatus, IQuest> callback)
        {
            Misc.CheckNotNull(quest);
            Misc.CheckNotNull(callback);
            callback = CallbackUtils.ToOnGameThread <QuestAcceptStatus, IQuest>(callback);

            var convertedQuest = quest as NativeQuest;

            if (convertedQuest == null)
            {
                Logger.e("Encountered quest that was not generated by this IQuestClient");
                callback(QuestAcceptStatus.BadInput, null);
                return;
            }

            mManager.Accept(convertedQuest, response =>
            {
                if (response.RequestSucceeded())
                {
                    callback(QuestAcceptStatus.Success, response.AcceptedQuest());
                }
                else
                {
                    callback(FromAcceptStatus(response.ResponseStatus()), null);
                }
            });
        }
Esempio n. 5
0
        public void ClaimMilestone(IQuestMilestone milestone,
                                   Action <QuestClaimMilestoneStatus, IQuest, IQuestMilestone> callback)
        {
            Misc.CheckNotNull(milestone);
            Misc.CheckNotNull(callback);
            callback = CallbackUtils.ToOnGameThread <QuestClaimMilestoneStatus, IQuest, IQuestMilestone>(
                callback);

            var convertedMilestone = milestone as NativeQuestMilestone;

            if (convertedMilestone == null)
            {
                Logger.e("Encountered milestone that was not generated by this IQuestClient");
                callback(QuestClaimMilestoneStatus.BadInput, null, null);
                return;
            }

            mManager.ClaimMilestone(convertedMilestone, response =>
            {
                if (response.RequestSucceeded())
                {
                    callback(QuestClaimMilestoneStatus.Success, response.Quest(),
                             response.ClaimedMilestone());
                }
                else
                {
                    callback(FromClaimStatus(response.ResponseStatus()), null, null);
                }
            });
        }
Esempio n. 6
0
        public void ClaimMilestone(IQuestMilestone milestone, Action <QuestClaimMilestoneStatus, IQuest, IQuestMilestone> callback)
        {
            Misc.CheckNotNull(milestone);
            Misc.CheckNotNull(callback);
            callback = CallbackUtils.ToOnGameThread(callback);
            NativeQuestMilestone nativeQuestMilestone = milestone as NativeQuestMilestone;

            if (nativeQuestMilestone == null)
            {
                Logger.e("Encountered milestone that was not generated by this IQuestClient");
                callback(QuestClaimMilestoneStatus.BadInput, null, null);
            }
            else
            {
                mManager.ClaimMilestone(nativeQuestMilestone, delegate(GooglePlayGames.Native.PInvoke.QuestManager.ClaimMilestoneResponse response)
                {
                    if (response.RequestSucceeded())
                    {
                        callback(QuestClaimMilestoneStatus.Success, response.Quest(), response.ClaimedMilestone());
                    }
                    else
                    {
                        callback(FromClaimStatus(response.ResponseStatus()), null, null);
                    }
                });
            }
        }
 public void IsCaptureAvailable(VideoCaptureMode captureMode, Action <ResponseStatus, bool> callback)
 {
     Misc.CheckNotNull(callback);
     callback = CallbackUtils.ToOnGameThread(callback);
     mManager.IsCaptureAvailable(ConversionUtils.ConvertVideoCaptureMode(captureMode), delegate(IsCaptureAvailableResponse response)
     {
         ResponseStatus arg = ConversionUtils.ConvertResponseStatus(response.GetStatus());
         if (!response.RequestSucceeded())
         {
             callback(arg, false);
         }
         else
         {
             callback(arg, response.IsCaptureAvailable());
         }
     });
 }
 public void GetCaptureState(Action <ResponseStatus, GooglePlayGames.BasicApi.Video.VideoCaptureState> callback)
 {
     Misc.CheckNotNull(callback);
     callback = CallbackUtils.ToOnGameThread(callback);
     mManager.GetCaptureState(delegate(GetCaptureStateResponse response)
     {
         ResponseStatus arg = ConversionUtils.ConvertResponseStatus(response.GetStatus());
         if (!response.RequestSucceeded())
         {
             callback(arg, null);
         }
         else
         {
             callback(arg, FromNativeVideoCaptureState(response.GetData()));
         }
     });
 }
Esempio n. 9
0
 public void FetchMatchingState(GooglePlayGames.BasicApi.DataSource source, QuestFetchFlags flags, Action <GooglePlayGames.BasicApi.ResponseStatus, List <IQuest> > callback)
 {
     Misc.CheckNotNull <Action <GooglePlayGames.BasicApi.ResponseStatus, List <IQuest> > >(callback);
     callback = CallbackUtils.ToOnGameThread <GooglePlayGames.BasicApi.ResponseStatus, List <IQuest> >(callback);
     this.mManager.FetchList(ConversionUtils.AsDataSource(source), (int)flags, (Action <GooglePlayGames.Native.PInvoke.QuestManager.FetchListResponse>)(response =>
     {
         GooglePlayGames.BasicApi.ResponseStatus responseStatus = ConversionUtils.ConvertResponseStatus(response.ResponseStatus());
         if (!response.RequestSucceeded())
         {
             callback(responseStatus, (List <IQuest>)null);
         }
         else
         {
             callback(responseStatus, response.Data().Cast <IQuest>().ToList <IQuest>());
         }
     }));
 }
Esempio n. 10
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));
            }
        }
Esempio n. 11
0
 public void FetchAllEvents(DataSource source, Action <ResponseStatus, List <IEvent> > callback)
 {
     Misc.CheckNotNull(callback);
     callback = CallbackUtils.ToOnGameThread(callback);
     mEventManager.FetchAll(ConversionUtils.AsDataSource(source), delegate(EventManager.FetchAllResponse response)
     {
         ResponseStatus arg = ConversionUtils.ConvertResponseStatus(response.ResponseStatus());
         if (!response.RequestSucceeded())
         {
             callback(arg, new List <IEvent>());
         }
         else
         {
             callback(arg, response.Data().Cast <IEvent>().ToList());
         }
     });
 }
Esempio n. 12
0
 public void FetchMatchingState(DataSource source, QuestFetchFlags flags, Action <ResponseStatus, List <IQuest> > callback)
 {
     Misc.CheckNotNull(callback);
     callback = CallbackUtils.ToOnGameThread(callback);
     mManager.FetchList(ConversionUtils.AsDataSource(source), (int)flags, delegate(GooglePlayGames.Native.PInvoke.QuestManager.FetchListResponse response)
     {
         ResponseStatus arg = ConversionUtils.ConvertResponseStatus(response.ResponseStatus());
         if (!response.RequestSucceeded())
         {
             callback(arg, null);
         }
         else
         {
             callback(arg, response.Data().Cast <IQuest>().ToList());
         }
     });
 }
Esempio n. 13
0
 public void FetchAllEvents(DataSource source, Action <ResponseStatus, List <IEvent> > callback)
 {
     Misc.CheckNotNull <Action <ResponseStatus, List <IEvent> > >(callback);
     callback = CallbackUtils.ToOnGameThread <ResponseStatus, List <IEvent> >(callback);
     this.mEventManager.FetchAll(ConversionUtils.AsDataSource(source), (Action <EventManager.FetchAllResponse>)(response =>
     {
         ResponseStatus responseStatus = ConversionUtils.ConvertResponseStatus(response.ResponseStatus());
         if (!response.RequestSucceeded())
         {
             callback(responseStatus, new List <IEvent>());
         }
         else
         {
             callback(responseStatus, response.Data().Cast <IEvent>().ToList <IEvent>());
         }
     }));
 }
Esempio n. 14
0
        public void ShowSpecificQuestUI(IQuest quest,
                                        Action <QuestUiResult, IQuest, IQuestMilestone> callback)
        {
            Misc.CheckNotNull(quest);
            Misc.CheckNotNull(callback);
            callback = CallbackUtils.ToOnGameThread <QuestUiResult, IQuest, IQuestMilestone>(callback);

            var convertedQuest = quest as NativeQuest;

            if (convertedQuest == null)
            {
                Logger.e("Encountered quest that was not generated by this IQuestClient");
                callback(QuestUiResult.BadInput, null, null);
                return;
            }

            mManager.ShowQuestUI(convertedQuest, FromQuestUICallback(callback));
        }
Esempio n. 15
0
 public void Fetch(DataSource source, string questId, Action <ResponseStatus, IQuest> callback)
 {
     Misc.CheckNotNull(questId);
     Misc.CheckNotNull(callback);
     callback = CallbackUtils.ToOnGameThread(callback);
     mManager.Fetch(ConversionUtils.AsDataSource(source), questId, delegate(GooglePlayGames.Native.PInvoke.QuestManager.FetchResponse response)
     {
         ResponseStatus arg = ConversionUtils.ConvertResponseStatus(response.ResponseStatus());
         if (!response.RequestSucceeded())
         {
             callback(arg, null);
         }
         else
         {
             callback(arg, response.Data());
         }
     });
 }
Esempio n. 16
0
 public void Fetch(GooglePlayGames.BasicApi.DataSource source, string questId, Action <GooglePlayGames.BasicApi.ResponseStatus, IQuest> callback)
 {
     Misc.CheckNotNull <string>(questId);
     Misc.CheckNotNull <Action <GooglePlayGames.BasicApi.ResponseStatus, IQuest> >(callback);
     callback = CallbackUtils.ToOnGameThread <GooglePlayGames.BasicApi.ResponseStatus, IQuest>(callback);
     this.mManager.Fetch(ConversionUtils.AsDataSource(source), questId, (Action <GooglePlayGames.Native.PInvoke.QuestManager.FetchResponse>)(response =>
     {
         GooglePlayGames.BasicApi.ResponseStatus responseStatus = ConversionUtils.ConvertResponseStatus(response.ResponseStatus());
         if (!response.RequestSucceeded())
         {
             callback(responseStatus, (IQuest)null);
         }
         else
         {
             callback(responseStatus, (IQuest)response.Data());
         }
     }));
 }
        public void GetCaptureState(Action <ResponseStatus, VideoCaptureState> callback)
        {
            Misc.CheckNotNull(callback);
            callback = CallbackUtils.ToOnGameThread(callback);
            mManager.GetCaptureState(
                response => {
                var status = ConversionUtils.ConvertResponseStatus(response.GetStatus());

                if (!response.RequestSucceeded())
                {
                    callback(status, null);
                }
                else
                {
                    callback(status, FromNativeVideoCaptureState(response.GetData()));
                }
            });
        }
Esempio n. 18
0
        public void IsCaptureAvailable(VideoCaptureMode captureMode, Action <ResponseStatus, bool> callback)
        {
            bubble.CheckNotNull(callback);
            callback = CallbackUtils.ToOnGameThread(callback);
            mManager.IsCaptureAvailable(ConversionUtils.ConvertVideoCaptureMode(captureMode),
                                        response => {
                var status = ConversionUtils.ConvertResponseStatus(response.GetStatus());

                if (!response.RequestSucceeded())
                {
                    callback(status, false);
                }
                else
                {
                    callback(status, response.IsCaptureAvailable());
                }
            });
        }
Esempio n. 19
0
        public void Fetch(DataSource source, string questId, Action <ResponseStatus, IQuest> callback)
        {
            Misc.CheckNotNull(questId);
            Misc.CheckNotNull(callback);
            callback = CallbackUtils.ToOnGameThread(callback);
            mManager.Fetch(ConversionUtils.AsDataSource(source), questId,
                           response =>
            {
                var status = ConversionUtils.ConvertResponseStatus(response.ResponseStatus());

                if (!response.RequestSucceeded())
                {
                    callback(status, null);
                }
                else
                {
                    callback(status, response.Data());
                }
            });
        }
Esempio n. 20
0
        public void FetchMatchingState(DataSource source, QuestFetchFlags flags,
                                       Action <ResponseStatus, List <IQuest> > callback)
        {
            Misc.CheckNotNull(callback);
            callback = CallbackUtils.ToOnGameThread(callback);

            mManager.FetchList(ConversionUtils.AsDataSource(source), (int)flags,
                               response =>
            {
                var status = ConversionUtils.ConvertResponseStatus(response.ResponseStatus());

                if (!response.RequestSucceeded())
                {
                    callback(status, null);
                }
                else
                {
                    callback(status, response.Data().Cast <IQuest>().ToList());
                }
            });
        }
Esempio n. 21
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));
 }
Esempio n. 22
0
 public void ShowAllQuestsUI(Action <QuestUiResult, IQuest, IQuestMilestone> callback)
 {
     Misc.CheckNotNull(callback);
     callback = CallbackUtils.ToOnGameThread <QuestUiResult, IQuest, IQuestMilestone>(callback);
     mManager.ShowAllQuestUI(FromQuestUICallback(callback));
 }