コード例 #1
0
 private void OnPurchaseMissingSoftCurrency(object result, object cookie)
 {
     if (GameUtils.HandleSoftCurrencyFlow(result, cookie))
     {
         ShardShopPurchaseCookie shardShopPurchaseCookie = null;
         if (cookie is CurrencyTag)
         {
             CurrencyTag currencyTag = (CurrencyTag)cookie;
             shardShopPurchaseCookie = (ShardShopPurchaseCookie)currencyTag.Cookie;
         }
         else if (cookie is MultiCurrencyTag)
         {
             MultiCurrencyTag multiCurrencyTag = (MultiCurrencyTag)cookie;
             shardShopPurchaseCookie = (ShardShopPurchaseCookie)multiCurrencyTag.Cookie;
         }
         if (shardShopPurchaseCookie != null)
         {
             shardShopPurchaseCookie.DeferredSuccessCallback(shardShopPurchaseCookie.Quantity, true);
             CostVO cost = shardShopPurchaseCookie.Cost;
             this.PurchasePoolIdShard(shardShopPurchaseCookie.SlotIndex, shardShopPurchaseCookie.Quantity, shardShopPurchaseCookie.ServerCallback, shardShopPurchaseCookie.Cookie, cost);
         }
         else
         {
             Service.Logger.Error("Shard Shop Missing soft currency purchase has null purchase cookie");
         }
     }
 }
コード例 #2
0
        private void OnPayMeForCurrencyResult(object result, object cookie)
        {
            bool flag = result != null;

            if (flag)
            {
                MultiCurrencyTag multiCurrencyTag = (MultiCurrencyTag)cookie;
                bool             flag2            = GameUtils.BuySoftCurrenciesWithCrystals(multiCurrencyTag.Credits, multiCurrencyTag.Materials, multiCurrencyTag.Contraband, multiCurrencyTag.Crystals, multiCurrencyTag.PurchaseContext, this.targetPerkVO.Uid);
                if (flag2)
                {
                    this.CompletePerkActivation();
                }
            }
            else
            {
                this.HideAndCleanUp();
            }
        }
コード例 #3
0
        private static bool ShowIfNotEnoughMultipleCurrenciesInternal(int credits, int materials, int contraband, int reputation, string purchaseContext, object purchaseCookie, OnScreenModalResult onModalResult)
        {
            CurrentPlayer currentPlayer = Service.CurrentPlayer;
            Dictionary <CurrencyType, int> dictionary = new Dictionary <CurrencyType, int>();
            int num  = credits - currentPlayer.CurrentCreditsAmount;
            int num2 = materials - currentPlayer.CurrentMaterialsAmount;
            int num3 = contraband - currentPlayer.CurrentContrabandAmount;

            if (num > 0)
            {
                dictionary.Add(CurrencyType.Credits, num);
            }
            else
            {
                num = 0;
            }
            if (num2 > 0)
            {
                dictionary.Add(CurrencyType.Materials, num2);
            }
            else
            {
                num2 = 0;
            }
            if (num3 > 0)
            {
                dictionary.Add(CurrencyType.Contraband, num3);
            }
            else
            {
                num3 = 0;
            }
            if (dictionary.Count > 0)
            {
                Lang          lang  = Service.Lang;
                bool          flag  = true;
                List <string> list  = new List <string>();
                List <string> list2 = new List <string>();
                foreach (KeyValuePair <CurrencyType, int> current in dictionary)
                {
                    CurrencyType key   = current.Key;
                    int          value = current.Value;
                    flag &= GameUtils.HasEnoughCurrencyStorage(key, value);
                    list.Add(UXUtils.GetCurrencyItemAssetName(key.ToString()));
                    string currencyStringId = LangUtils.GetCurrencyStringId(key);
                    string str = lang.Get(currencyStringId, new object[0]);
                    list2.Add(lang.ThousandsSeparated(value) + " " + str);
                }
                if (flag)
                {
                    string                   title                    = lang.Get("NEED_MORE_MULTI", new object[0]);
                    string                   message                  = lang.Get("NEED_MORE_MULTI_BUY_MISSING", new object[0]);
                    int                      num4                     = GameUtils.MultiCurrencyCrystalCost(dictionary);
                    MultiCurrencyTag         modalResultCookie        = new MultiCurrencyTag(num, num2, num3, num4, purchaseContext, purchaseCookie);
                    MultiResourcePayMeScreen multiResourcePayMeScreen = new MultiResourcePayMeScreen(num4, title, message, list, list2);
                    multiResourcePayMeScreen.OnModalResult     = onModalResult;
                    multiResourcePayMeScreen.ModalResultCookie = modalResultCookie;
                    Service.ScreenController.AddScreen(multiResourcePayMeScreen);
                }
                else
                {
                    onModalResult(null, null);
                }
                return(true);
            }
            dictionary.Clear();
            dictionary = null;
            return(false);
        }
コード例 #4
0
        public static bool ShowIfNotEnoughMultipleCurrencies(string[] cost, string purchaseContext, OnScreenModalResult onModalResult)
        {
            CurrentPlayer currentPlayer = Service.Get <CurrentPlayer>();
            int           num;
            int           num2;
            int           num3;
            int           num4;

            GameUtils.GetHQScaledCurrency(cost, out num, out num2, out num3, out num4);
            Dictionary <CurrencyType, int> dictionary = new Dictionary <CurrencyType, int>();
            int num5 = num - currentPlayer.CurrentCreditsAmount;
            int num6 = num2 - currentPlayer.CurrentMaterialsAmount;
            int num7 = num3 - currentPlayer.CurrentContrabandAmount;

            if (num5 > 0)
            {
                dictionary.Add(CurrencyType.Credits, num5);
            }
            else
            {
                num5 = 0;
            }
            if (num6 > 0)
            {
                dictionary.Add(CurrencyType.Materials, num6);
            }
            else
            {
                num6 = 0;
            }
            if (num7 > 0)
            {
                dictionary.Add(CurrencyType.Contraband, num7);
            }
            else
            {
                num7 = 0;
            }
            if (dictionary.Count > 0)
            {
                Lang          lang  = Service.Get <Lang>();
                bool          flag  = true;
                List <string> list  = new List <string>();
                List <string> list2 = new List <string>();
                foreach (KeyValuePair <CurrencyType, int> current in dictionary)
                {
                    CurrencyType key   = current.get_Key();
                    int          value = current.get_Value();
                    flag &= GameUtils.HasEnoughCurrencyStorage(key, value);
                    list.Add(UXUtils.GetCurrencyItemAssetName(key.ToString()));
                    string currencyStringId = LangUtils.GetCurrencyStringId(key);
                    string text             = lang.Get(currencyStringId, new object[0]);
                    list2.Add(lang.ThousandsSeparated(value) + " " + text);
                }
                if (flag)
                {
                    string                   title                    = lang.Get("NEED_MORE_MULTI", new object[0]);
                    string                   message                  = lang.Get("NEED_MORE_MULTI_BUY_MISSING", new object[0]);
                    int                      num8                     = GameUtils.MultiCurrencyCrystalCost(dictionary);
                    MultiCurrencyTag         modalResultCookie        = new MultiCurrencyTag(num5, num6, num7, num8, purchaseContext);
                    MultiResourcePayMeScreen multiResourcePayMeScreen = new MultiResourcePayMeScreen(num8, title, message, list, list2);
                    multiResourcePayMeScreen.OnModalResult     = onModalResult;
                    multiResourcePayMeScreen.ModalResultCookie = modalResultCookie;
                    Service.Get <ScreenController>().AddScreen(multiResourcePayMeScreen);
                }
                else
                {
                    onModalResult(null, null);
                }
                return(true);
            }
            dictionary.Clear();
            dictionary = null;
            return(false);
        }