Exemple #1
0
 public void AddUnlockStarTierPopup(UnavailablePartButton button, UnlockRoadHogsParts dialog, int tier, int currentStars, int cost, Func <bool> requirements)
 {
     if (button == null || dialog == null)
     {
         return;
     }
     button.OnPress = (Action)Delegate.Combine(button.OnPress, new Action(delegate()
     {
         dialog.Cost = string.Format("[snout] {0}", cost);
         dialog.ShowConfirmEnabled = (() => true);
         dialog.SetOnConfirm(delegate
         {
             if (requirements() && GameProgress.UseSnoutCoins(cost))
             {
                 int num = tier - currentStars;
                 GameProgress.AddRaceLevelUnlockedStars(num);
                 Dictionary <string, string> data = new Dictionary <string, string>
                 {
                     {
                         "Item_name",
                         "Snout Coin"
                     },
                     {
                         "Type_of_item",
                         "currency"
                     },
                     {
                         "Amount",
                         string.Format("{0}", cost)
                     },
                     {
                         "Type_of_use",
                         "Unlock Race Level Stars"
                     },
                     {
                         "Screen",
                         "Race Level"
                     },
                     {
                         "Level",
                         Singleton <GameManager> .Instance.CurrentLevelIdentifier
                     },
                     {
                         "Unlocked_star_count",
                         string.Format("{0}", num)
                     }
                 };
                 Singleton <AudioManager> .Instance.Spawn2dOneShotEffect(WPFMonoBehaviour.gameData.commonAudioCollection.snoutCoinUse);
                 this.CreatePartList(false);
                 dialog.Close();
             }
             else if (!requirements() && Singleton <IapManager> .IsInstantiated())
             {
                 dialog.Close();
                 Singleton <IapManager> .Instance.OpenShopPage(new Action(dialog.Open), "SnoutCoinShop");
             }
             else
             {
                 dialog.Close();
             }
         });
         dialog.Open();
     }));
 }