Exemple #1
0
        public static bool ShowIfNotEnoughMultipleCurrencies(string[] cost, string purchaseContext, OnScreenModalResult onModalResult)
        {
            int credits;
            int materials;
            int contraband;
            int reputation;

            GameUtils.GetHQScaledCurrency(cost, out credits, out materials, out contraband, out reputation);
            return(MultiResourcePayMeScreen.ShowIfNotEnoughMultipleCurrenciesInternal(credits, materials, contraband, reputation, purchaseContext, null, onModalResult));
        }
Exemple #2
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);
        }
Exemple #3
0
 public static bool ShowIfNotEnoughMultipleCurrencies(CostVO cost, string purchaseContext, OnScreenModalResult onModalResult)
 {
     return(MultiResourcePayMeScreen.ShowIfNotEnoughMultipleCurrenciesInternal(cost.Credits, cost.Materials, cost.Contraband, cost.Reputation, purchaseContext, null, onModalResult));
 }
Exemple #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);
        }
Exemple #5
0
 public unsafe static long $Invoke3(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(MultiResourcePayMeScreen.ShowIfNotEnoughMultipleCurrencies((string[])GCHandledObjects.GCHandleToPinnedArrayObject(*args), Marshal.PtrToStringUni(*(IntPtr *)(args + 1)), (OnScreenModalResult)GCHandledObjects.GCHandleToObject(args[2]))));
 }