コード例 #1
0
        public static void BuyVotesPack(VotesPack votesPack, BalanceTopupSource source, Action successCallback = null, Action errorCallback = null)
        {
            FullscreenLoader loader = new FullscreenLoader();

            loader.Show(null, true);
            EventAggregator.Current.Publish((object)new BalanceTopupEvent(source, BalanceTopupAction.purchase_click));
            StoreService.Instance.PurchaseVotesPack(votesPack, (Action)(() =>
            {
                EventAggregator.Current.Publish((object)new BalanceTopupEvent(source, BalanceTopupAction.success));
                StorePurchaseManager.UpdateBalanceData((Action)(() =>
                {
                    loader.Hide(false);
                    Action action = successCallback;
                    if (action == null)
                    {
                        return;
                    }
                    action();
                }));
            }), (Action <BackendResult <StorePurchaseResult, ResultCode> >)(result =>
            {
                loader.HiddenCallback = (Action <FullscreenLoaderHiddenEventArgs>)(args => StorePurchaseManager.HandleStorePurchaseError(result, errorCallback));
                loader.Hide(false);
            }), (Action)(() => loader.Hide(false)));
        }
コード例 #2
0
        public static void RestorePurchases(string productId = null)
        {
            FullscreenLoader loader = new FullscreenLoader();

            loader.Show(null, true);
            StoreService.Instance.RestorePurchases(productId, (Action)(() => StorePurchaseManager.UpdateBalanceData((Action)(() => loader.Hide(false)))), (Action <BackendResult <StorePurchaseResult, ResultCode> >)(result =>
            {
                loader.HiddenCallback = (Action <FullscreenLoaderHiddenEventArgs>)(args => StorePurchaseManager.HandleStorePurchaseError(result, null));
                loader.Hide(false);
            }));
        }