示例#1
0
 private void ApplyRocketTries(StoreProductData product)
 {
     if (GlobalRefs.MiniGamesScreen != null)
     {
         GlobalRefs.MiniGamesScreen.IncreaseTriesPaid(MiniGameType.BreakLiner);
     }
 }
示例#2
0
 private void OnStoreProductPurchased(StoreProductData data)
 {
     if (IsLoaded)
     {
         ToggleMainScreenButton();
     }
 }
示例#3
0
        public void PurchaseProduct(StoreProductData product)
        {
            UDBG.Log($"start purchasing with store id: {product.StoreId}");

#if UNITY_EDITOR || BOSDEBUG
            ProductReward.Execute(product);
            return;
#else
            if (product == null)
            {
                UDBG.Log($"Product what you try purchase is NULL".Attrib(bold: true, italic: true, color: "r"));
                return;
            }
            if (!IsInitialized)
            {
                UDBG.LogError($"UnityPurchasing is not initialized".Attrib(bold: true, italic: true, color: "r"));
                return;
            }

            Product unityProduct = storeController.products.WithID(product.StoreId);
            if (unityProduct == null)
            {
                UDBG.Log($"Purchase error: product with store ID: {product.StoreId} is NULL".Attrib(bold: true, italic: true, color: "r"));
                return;
            }
            if (false == unityProduct.availableToPurchase)
            {
                UDBG.Log($"Purchase error: product with store ID: {product.StoreId} is not available to purchase".Attrib(bold: true, italic: true, color: "r"));
                return;
            }

            CreateLoadingScreen();
            storeController.InitiatePurchase(unityProduct);
#endif
        }
示例#4
0
 private void ApplyProfitUpgrade(StoreProductData product)
 {
     services.GenerationService.Generators.AddProfitBoost(
         boost: BoostInfo.CreateTemp(
             id: $"iap_{product.StoreId}_".GuidSuffix(5),
             value: product.BonusValue));
 }
示例#5
0
 private void ApplyTreasureHuntTries(StoreProductData product)
 {
     if (GlobalRefs.MiniGamesScreen != null)
     {
         GlobalRefs.MiniGamesScreen.IncreaseTriesPaid(MiniGameType.TreasureHunt);
     }
 }
示例#6
0
 private void ApplyPrizeWheelTries(StoreProductData product)
 {
     if (GlobalRefs.MiniGamesScreen != null)
     {
         GlobalRefs.MiniGamesScreen.IncreaseTriesPaid(MiniGameType.PrizeWheel);
     }
 }
示例#7
0
 public Option <Product> GetProductByResourceId(int id)
 {
     if (IsInitialized)
     {
         StoreProductData productData = ResourceService.Products.GetProduct(id);
         if (productData != null)
         {
             return(GetProductByStoreId(productData.StoreId));
         }
     }
     return(F.None);
 }
示例#8
0
 public void Execute(StoreProductData product)
 {
     services.PlayerService.AddCoins(product.Coins);
     StatsCollector.Instance[Stats.MONEY_SPENT] += product.Price;
     if (product.HasBonus)
     {
         if (bonusMap.ContainsKey(product.BonusType))
         {
             bonusMap[product.BonusType](product);
         }
         else
         {
             UDBG.Log($"not founded bonus purchase handler {product.BonusType} for product {product.StoreId}".Attrib(bold: true, italic: true, color: "r"));
         }
     }
     GameEvents.StoreProductPurchasedObservable.OnNext(product);
     GameEvents.OnStoreProductPurchased(product);
 }
示例#9
0
 static void Postfix()
 {
     if (!enabled)
     {
         return;
     }
     foreach (Weapon weapon in weapons)
     {
         StoreProductData spdata = new StoreProductData()
         {
             productId        = weapon.productId,
             itemId           = weapon.itemId,
             currency_itemId  = weapon.currency,
             exchangeRateData = weapon.exchange,
             reqMissionId     = weapon.requireMissions,
             isLimited        = false,
             dlcRequired      = "",
         };
         typeof(StoreProductData).GetMethod("Init", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(spdata, new object[] { });
         StoreProductData.refDataDic.Add(spdata);
     }
 }
示例#10
0
 static void Postfix()
 {
     if (!enabled)
     {
         return;
     }
     foreach (StoreItem item in storeItems)
     {
         StoreProductData spdata = new StoreProductData()
         {
             productId        = item.productId,
             itemId           = item.itemId,
             currency_itemId  = item.currency,
             exchangeRateData = item.exchange,
             reqMissionId     = item.requireMissions,
             isLimited        = false,
             dlcRequired      = "",
         };
         Dbgl($"added item to store database: {ItemDataMgr.Self.GetItemName(item.itemId)}");
         typeof(StoreProductData).GetMethod("Init", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(spdata, new object[] { });
         StoreProductData.refDataDic.Add(spdata);
     }
 }
示例#11
0
 private double GetSoldCurrencyValue(StoreProductData data)
 {
     return(GetMaxCurrencyValue(data) * data.BonusValue);
 }
示例#12
0
 public static void OnStoreProductPurchased(StoreProductData data)
 => StoreProductPurchasedEvent?.Invoke(data);
示例#13
0
        private void ApplyCompanyCash(StoreProductData product)
        {
            var Player = services.PlayerService;

            Player.AddGenerationCompanyCash(Player.MaxCompanyCash * product.BonusValue);
        }
示例#14
0
 private void ApplyLootbox(StoreProductData product)
 {
     services.RewardsService.AddAvailableRewards(product.BonusValue);
 }
示例#15
0
 private double GetMaxCurrencyValue(StoreProductData data)
 {
     return(Services.PlayerService.GetCurrencyMaxValue(data.CurrencyType));
 }
示例#16
0
 private void ApplySpecialOffer(StoreProductData product)
 {
     services.GetService <ISpecialOfferService>().OnOfferPurchased();
 }
示例#17
0
 private void ApplyPlayerCash(StoreProductData product)
 {
     services.PlayerService.AddPlayerCash(new CurrencyNumber(services.PlayerService.MaxPlayerCash * product.BonusValue));
 }
示例#18
0
 private void ApplySecurities(StoreProductData product)
 {
     services.PlayerService.AddSecurities(new CurrencyNumber(services.PlayerService.MaxSecurities * product.BonusValue));
 }