コード例 #1
0
        public static void SetupSingleResourceUI(CostVO cost, UXLabel label, UXSprite sprite)
        {
            int          amount = 0;
            CurrencyType type   = CurrencyType.None;

            if (cost.Credits > 0)
            {
                type   = CurrencyType.Credits;
                amount = cost.Credits;
            }
            if (cost.Materials > 0)
            {
                type   = CurrencyType.Materials;
                amount = cost.Materials;
            }
            if (cost.Contraband > 0)
            {
                type   = CurrencyType.Contraband;
                amount = cost.Contraband;
            }
            if (cost.Crystals > 0)
            {
                type   = CurrencyType.Crystals;
                amount = cost.Crystals;
            }
            UXUtils.SetupSingleResourceUI(amount, type, label, sprite, cost.Credits, cost.Materials, cost.Contraband, cost.Crystals);
        }
コード例 #2
0
        public static void SetupTargetedOfferCostUI(TargetedBundleVO currentOffer, UXLabel label, UXSprite sprite)
        {
            string[] cost = currentOffer.Cost;
            if (cost == null || cost.Length == 0)
            {
                Service.Logger.Error("SetupCurrencyCostOffer Cost was empty or null: " + currentOffer.Uid);
                return;
            }
            string       costString = cost[0];
            CurrencyType type       = CurrencyType.None;
            int          num        = -1;
            int          credits    = 0;
            int          materials  = 0;
            int          contraband = 0;
            int          crystals   = 0;

            if (GameUtils.ParseCurrencyCostString(costString, out type, out num))
            {
                switch (type)
                {
                case CurrencyType.Credits:
                    credits = num;
                    break;

                case CurrencyType.Materials:
                    materials = num;
                    break;

                case CurrencyType.Contraband:
                    contraband = num;
                    break;

                case CurrencyType.Crystals:
                    crystals = num;
                    break;
                }
            }
            UXUtils.SetupSingleResourceUI(num, type, label, sprite, credits, materials, contraband, crystals);
        }