Beispiel #1
0
        public void ReturnPurchaseItems()
        {
            var returnedItems = PurchasedItems.ToList();

            PurchasedItems.Clear();

            DomainEvents.Raise(new ReturnedItemsEvent(DateTime.Now, returnedItems.ToArray()));
        }
Beispiel #2
0
        public void UpdatePurchaseItems(IEnumerable <PurchaseItem> purchasedItems)
        {
            var returnedItems = PurchasedItems.ToList();

            DomainEvents.Raise(new ReturnedItemsEvent(DateTime.Now, returnedItems.ToArray()));

            PurchasedItems.Clear();
            PurchasedItems.AddRange(purchasedItems);
            DomainEvents.Raise(new PurchasedItemsEvent(DateTime.Now, purchasedItems.ToArray()));

            Modified = DateTime.Now;
        }
Beispiel #3
0
        public override void LoadSave(object obj)
        {
            InapServiceSave save = obj as InapServiceSave;

            if (save == null)
            {
                LoadDefaults();
            }
            else
            {
                save.Validate();
                PurchasedItems.Clear();
                PurchasedItems.CopyFrom(save.purchasedItems);
                IsLoaded = true;
            }
        }
 public static void GetInventoryInternal(PlayfabSave saveInstance)
 {
     if (isRefreshing)
     {
         return;
     }
     isRefreshing = true;
     if (saveInstance != null)
     {
         saveInstance.onRefreshing.Invoke();
     }
     PlayFabClientAPI.GetUserInventory(new GetUserInventoryRequest(), (result) =>
     {
         isRefreshing = false;
         currencies   = result.VirtualCurrency;
         items.Clear();
         foreach (var item in result.Inventory)
         {
             items.Add(item.ItemId);
         }
         if (saveInstance != null)
         {
             saveInstance.onRefresh.Invoke();
         }
         if (!isRefreshFirstTime)
         {
             isRefreshFirstTime = true;
             if (saveInstance != null)
             {
                 saveInstance.onRefreshFirstTime.Invoke();
             }
         }
     }, (error) =>
     {
         isRefreshing = false;
         Debug.LogError("[Playfab Save] " + error.ErrorMessage);
         if (saveInstance != null)
         {
             saveInstance.onError.Invoke(error.ErrorMessage);
         }
     });
 }
 public void SetPurchasedItems(List <PurchasedItem> items)
 {
     PurchasedItems.Clear();
     PurchasedItems.AddRange(items);
     OnPurchasedItemsChanged?.Invoke();
 }
Beispiel #6
0
 private void Reset()
 {
     PurchasedItems.Clear();
     CartLines.Refresh();
     UpdateView();
 }