示例#1
0
 public void LoadStore(ISN_SKLib.SA_PluginSettingsWindowStylesitRequest request, Action <ISN_SKInitResult> callback)
 {
     SA_Coroutine.WaitForSeconds(DelayTime, () => {
         ISN_SKInitResult res = new ISN_SKInitResult(ISN_Settings.Instance.InAppProducts);
         callback.Invoke(res);
     });
 }
 public void LoadTopScores(AN_LeaderboardsClient client, string leaderboardId, int span, int leaderboardCollection, int maxResults, bool forceReload, Action <AN_LinkedObjectResult <AN_LeaderboardScores> > callback)
 {
     SA_Coroutine.WaitForSeconds(1, () => {
         var result = new AN_LinkedObjectResult <AN_LeaderboardScores>(new AN_LeaderboardScores());
         callback.Invoke(result);
     });
 }
示例#3
0
 public void Purchase(AN_VendingLib.AN_PurchaseRequest request, Action <AN_BillingPurchaseResult> callback)
 {
     SA_Coroutine.WaitForSeconds(1, () => {
         AN_Purchase purchase = new AN_Purchase(request.m_product.ProductId, request.m_product.Type.ToString(), request.m_developerPayload);
         callback.Invoke(new AN_BillingPurchaseResult(purchase));
     });
 }
        //--------------------------------------
        // Public Methods
        //--------------------------------------


        public void Share(Action callback = null)
        {
            if (Application.isEditor)
            {
                SA_Coroutine.WaitForSeconds(1, () => {
                    if (callback != null)
                    {
                        callback.Invoke();
                    }
                });

                return;
            }

            AN_PermissionsUtility.TryToResolvePermission(new [] { AMM_ManifestPermission.WRITE_EXTERNAL_STORAGE, AMM_ManifestPermission.READ_EXTERNAL_STORAGE }, (granted) =>
            {
                if (!granted)
                {
                    AN_Logger.LogError("User haven't granted required sharing permissions: " +
                                       "WRITE_EXTERNAL_STORAGE, READ_EXTERNAL_STORAGE. " +
                                       "Sharing may not be fully completed.");
                }
                ShowSharingDialog(callback);
            });
        }
 public void Load(AN_AchievementsClient client, bool forceReload, Action <AN_AchievementsLoadResult> callback)
 {
     SA_Coroutine.WaitForSeconds(1, () => {
         //TODO might me cool to get info from saved games-ids.xml
         callback.Invoke(new AN_AchievementsLoadResult());
     });
 }
 public void SubmitScoreImmediate(AN_LeaderboardsClient client, string leaderboardId, long score, string scoreTag, Action <AN_LinkedObjectResult <AN_ScoreSubmissionData> > callback)
 {
     SA_Coroutine.WaitForSeconds(1, () => {
         var result = new AN_LinkedObjectResult <AN_ScoreSubmissionData>(new AN_ScoreSubmissionData());
         callback.Invoke(result);
     });
 }
        //--------------------------------------
        // AN_SnapshotsClient
        //--------------------------------------

        public void ShowSelectSnapshotIntent(AN_SnapshotsClient client, string title, bool allowAddButton, bool allowDelete, int maxSnapshots, Action <AN_SnapshotUIResult> callback)
        {
            SA_Coroutine.WaitForSeconds(1, () => {
                var result = new AN_SnapshotUIResult((int)AN_SnapshotUIResult.UserInteractionState.NOTHING_SELECTED);
                callback.Invoke(result);
            });
        }
 public void Open(AN_SnapshotsClient client, string name, bool createIfNotFound, int conflictPolicy, Action <AN_LinkedObjectResult <AN_DataOrConflictResult> > callback)
 {
     SA_Coroutine.WaitForSeconds(1, () => {
         var result = new AN_LinkedObjectResult <AN_DataOrConflictResult>(new AN_DataOrConflictResult());
         callback.Invoke(result);
     });
 }
示例#9
0
        /// <summary>
        /// Start the dialog and display it on screen.
        /// </summary>
        public override void Show()
        {
            if (Application.isEditor)
            {
                foreach (var button in m_buttons)
                {
                    if (button.m_type == POSITIVE)
                    {
                        SA_Coroutine.WaitForSeconds(1, () => {
                            button.m_callback.Invoke();
                        });
                        return;
                    }
                }
                return;
            }

            AN_AppLib.API.AlertDialogShow(this, (closeResult) => {
                foreach (var button in m_buttons)
                {
                    if (button.m_id.Equals(closeResult.m_buttonid))
                    {
                        button.m_callback.Invoke();
                        return;
                    }
                }

                //looks like alert was dismissed wihtout user taping buttons
                //so far this is disabled, let's see if we gonna need it in guture
                // OnUserCanceled.Invoke();
            });
        }
 public void Delete(AN_SnapshotsClient client, AN_SnapshotMetadata meta, Action <AN_SnapshotsDeleteResult> callback)
 {
     SA_Coroutine.WaitForSeconds(1, () => {
         var result = new AN_SnapshotsDeleteResult();
         callback.Invoke(result);
     });
 }
 public void LoadLeaderboardMetadata(AN_LeaderboardsClient client, string leaderboardId, bool forceReload, Action <AN_LeaderboardLoadResult> callback)
 {
     SA_Coroutine.WaitForSeconds(1, () => {
         var result = new AN_LeaderboardLoadResult();
         callback.Invoke(result);
     });
 }
 public void LoadMoreScores(AN_LeaderboardsClient client, AN_LeaderboardScoreBuffer buffer, int maxResults, int pageDirection, Action <AN_LinkedObjectResult <AN_LeaderboardScores> > callback)
 {
     SA_Coroutine.WaitForSeconds(1, () => {
         var result = new AN_LinkedObjectResult <AN_LeaderboardScores>(new AN_LeaderboardScores());
         callback.Invoke(result);
     });
 }
 public void CommitAndClose(AN_SnapshotsClient client, AN_Snapshot snapshot, AN_SnapshotMetadataChange metadataChange, Action <AN_SnapshotMetadataResult> callback)
 {
     SA_Coroutine.WaitForSeconds(1, () => {
         var result = new AN_SnapshotMetadataResult(new AN_SnapshotMetadata());
         callback.Invoke(result);
     });
 }
 public void LoadCurrentPlayerLeaderboardScore(AN_LeaderboardsClient client, string leaderboardId, int span, int leaderboardCollection, Action <AN_LinkedObjectResult <AN_LeaderboardScore> > callback)
 {
     SA_Coroutine.WaitForSeconds(1, () => {
         var result = new AN_LinkedObjectResult <AN_LeaderboardScore>(new AN_LeaderboardScore());
         callback.Invoke(result);
     });
 }
 public void GetCurrentPlayer(AN_PlayersClient client, Action <AN_LinkedObjectResult <AN_Player> > callback)
 {
     SA_Coroutine.WaitForSeconds(1, () => {
         var result = new AN_LinkedObjectResult <AN_Player>(new AN_Player());
         callback.Invoke(result);
     });
 }
 public void GoogleSignInClient_SignOut(AN_GoogleSignInClient client, Action <SA_Result> callback)
 {
     SA_Coroutine.WaitForSeconds(1, () => {
         m_alreadySignedIn = false;
         callback.Invoke(new SA_Result());
     });
 }
 public void ResolveConflict(AN_SnapshotsClient client, string conflictId, AN_Snapshot snapshot,
                             Action <AN_LinkedObjectResult <AN_DataOrConflictResult> > callback)
 {
     SA_Coroutine.WaitForSeconds(1, () => {
         var result = new AN_LinkedObjectResult <AN_DataOrConflictResult>(new AN_DataOrConflictResult());
         callback.Invoke(result);
     });
 }
        public void Load(string id, Action <SA_Result> callback)
        {
#if SA_UNITY_ADS_INSTALLED
            m_advertisementId = id;
            m_loadCallback    = callback;
            SA_Coroutine.Start(WaitForLoad());
#endif
        }
        public override void Test()
        {
            AN_Preloader.LockScreen("Lock Test");

            SA_Coroutine.WaitForSeconds(3f, () => {
                AN_Preloader.UnlockScreen();
            });
        }
        //--------------------------------------
        // AN_GoogleSignInClient
        //--------------------------------------


        public void GoogleSignInClient_SignIn(AN_GoogleSignInClient client, Action <AN_GoogleSignInResult> callback)
        {
            SA_Coroutine.WaitForSeconds(1, () => {
                m_alreadySignedIn     = true;
                m_canDoSilentSignedIn = true;
                callback.Invoke(new AN_GoogleSignInResult(new AN_GoogleSignInAccount()));
            });
        }
示例#21
0
        public void AddPayment(string productIdentifier)
        {
            SA_Coroutine.WaitForSeconds(DelayTime, () => {
                var produdct     = ISN_SKPaymentQueue.GetProductById(productIdentifier);
                var tranasaction = new ISN_SKPaymentTransaction(produdct, ISN_SKPaymentTransactionState.Purchased);

                m_transactionUpdated.Invoke(tranasaction);
            });
        }
示例#22
0
        /// <summary>
        /// Launch an activity for which you would like a result when it finished.
        /// When this activity exits, your callback will be called.
        /// </summary>
        /// <param name="intent">The intent to start.</param>
        /// <param name="callback">Activity result callback</param>
        public bool StartActivityForResult(AN_Intent intent, Action <AN_ActivityResult> callback)
        {
            if (Application.isEditor)
            {
                SA_Coroutine.WaitForSeconds(1, () => {
                    callback.Invoke(new AN_ActivityResult());
                });
                return(true);
            }

            return(AN_Java.Bridge.CallStaticWithCallback <bool, AN_ActivityResult>(ANDROID_CLASS, "StartActivityForResult", callback, this, intent));
        }
 private static void SendRequest(UnityWebRequest request, Action <UnityWebRequest> callback)
 {
     if (m_cache.ContainsKey(request.url))
     {
         callback.Invoke(m_cache[request.url]);
         return;
     }
     SA_Coroutine.Start(SendRequestCorutine(request, (result) => {
         m_cache.Add(result.url, result);
         callback.Invoke(result);
     }));
 }
示例#24
0
        protected override void ConnectToService(string appId, Action <SA_Result> callback)
        {
#if SA_UNITY_ADS_INSTALLED
            m_initCallback = callback;
            Monetization.Initialize(appId, UM_UnityAdsSettings.Instance.TestMode);

            SA_Coroutine.Start(WaitForInitialization());
#else
            var error  = new SA_Error(1, "Unity Ads SDK is missing");
            var result = new SA_Result(error);
            callback.Invoke(result);
#endif
        }
        public void Retrieve(Action <UM_ContactsResult> callback)
        {
            SA_Coroutine.WaitForSeconds(2f, () => {
                List <UM_iContact> contacts = new List <UM_iContact>();
                foreach (var contact in UM_Settings.Instance.EditorTestingContacts)
                {
                    contacts.Add(contact.Clone());
                }

                var loadResult = new UM_ContactsResult(contacts);
                callback.Invoke(loadResult);
            });
        }
示例#26
0
 public void RestoreCompletedTransactions()
 {
     SA_Coroutine.WaitForSeconds(DelayTime, () => {
         foreach (var product in ISN_SKPaymentQueue.Products)
         {
             if (product.Type == ISN_SKProductType.NonConsumable)
             {
                 var tranasaction = new ISN_SKPaymentTransaction(product, ISN_SKPaymentTransactionState.Restored);
                 m_transactionUpdated.Invoke(tranasaction);
             }
         }
         m_restoreTransactionsComplete.Invoke(new SA_Result());
     });
 }
 public void GoogleSignInClient_SilentSignIn(AN_GoogleSignInClient client, Action <AN_GoogleSignInResult> callback)
 {
     SA_Coroutine.WaitForSeconds(1, () => {
         if (m_canDoSilentSignedIn)
         {
             m_alreadySignedIn = true;
             callback.Invoke(new AN_GoogleSignInResult(new AN_GoogleSignInAccount()));
         }
         else
         {
             var error = new SA_Error((int)AN_CommonStatusCodes.SIGN_IN_REQUIRED, "SIGN_IN_REQUIRED");
             callback.Invoke(new AN_GoogleSignInResult(error));
         }
     });
 }
示例#28
0
        public void Delete(UM_iSavedGameMetadata game, Action <SA_Result> callback)
        {
            var editorGamesList = LoadSavesList();
            var editorGame      = editorGamesList.GetByName(game.Name);

            if (editorGame != null)
            {
                editorGamesList.Saves.Remove(editorGame);
                EditorSaveGames(editorGamesList);
            }

            SA_Coroutine.WaitForSeconds(1.5f, () => {
                callback.Invoke(new SA_Result());
            });
        }
示例#29
0
        public static void PickImageFromGallery(int maxSize, AN_GalleryChooseType type, bool allowMultiSelect, Action <AN_GalleryPickResult> callback)
        {
            if (Application.isEditor)
            {
                SA_Coroutine.WaitForSeconds(1, () => {
                    var error = new SA_Error(100, "Gallery does not available on current device");
                    callback.Invoke(new AN_GalleryPickResult(error));
                });
                return;
            }

            int chooserType = (int)type;

            AN_Java.Bridge.CallStaticWithCallback(ANDROID_CLASS, "PickImageFromGallery", callback, maxSize, chooserType, allowMultiSelect);
        }
示例#30
0
        public void FetchSavedGames(Action <UM_SavedGamesMetadataResult> callback)
        {
            var loadResult      = new UM_SavedGamesMetadataResult();
            var editorGamesList = LoadSavesList();

            foreach (EditorSavedGame game in editorGamesList.Saves)
            {
                loadResult.AddMetadata(game);
            }

            SA_Coroutine.WaitForSeconds(1.5f, () =>
            {
                callback.Invoke(loadResult);
            });
        }