Пример #1
0
    public void UpdateDisplays()
    {
        costDisplay.text        = formatter.FormatNumber(Cost);
        levelDisplay.text       = "Level " + (Level + freeLevels).ToString("N0");
        levelSourceDisplay.text = level.ToString("N0") + " levels from upgrading";
        if (freeLevels > 0)
        {
            levelSourceDisplay.text += "\n" + freeLevels.ToString("N0") + " free levels from dropping coins";
        }
        if (diamond.diamondMultiLevels > 0)
        {
            levelSourceDisplay.text += "\n" + diamond.diamondMultiLevels.ToString("N0") + " levels from diamond upgrade";
        }

        multiplierDisplay.text = CoinMulti.ToString("N2") + "x coins";
        if (upgradeHandler.IsUpgradePurchased(204))
        {
            multiplierDisplay.text += "\n" + formatter.FormatNumber(upgradeHandler.GetEffect(204)) + "x clickpoints";
        }
        if (upgradeHandler.IsUpgradePurchased(304))
        {
            multiplierDisplay.text += "\n" + formatter.FormatNumber(upgradeHandler.GetEffect(304)) + "x experience";
        }
        if (upgradeHandler.IsUpgradePurchased(31))
        {
            multiplierDisplay.text += "\n+" + (Level * 0.75f).ToString("N1") + "% extra coin chance";
        }
        if (upgradeHandler.IsUpgradePurchased(45))
        {
            multiplierDisplay.text += "\n" + DiamondCoinMulti.ToString("N3") + "x diamond coins";
        }
    }
Пример #2
0
 // Use this for initialization
 void Start()
 {
     upgradeHandler         = UpgradeHandler.instance;
     formatter              = NumberFormatter.instance;
     costDisplay.text       = formatter.FormatNumber(Cost);
     multiplierDisplay.text = GetMultiplier().ToString("N1") + "x coins from clicks";
 }
Пример #3
0
 public override void UpdateTooltipText()
 {
     stringToDisplay = "Increase your tier to unlock content\n" +
                       "and further boost your coins.\n" +
                       "<color=red>This also doubles your upgrade cost!</color>\n" +
                       "<color=lime>Next: Unlock {0}.</color>\n" +
                       "<color=yellow>Cost: {1} coins.</color>";
     objects.Add(namesOfItemsToUnlock[tier]);
     objects.Add(formatter.FormatNumber(cost));
 }
        private static void TestResult(string number, string locale, string format, string expect)
        {
            var result = NumberFormatter.FormatNumber(number, new FormatOptions
            {
                Locale = locale,
                Format = format
            });

            Console.WriteLine($"L: {locale} N: {number} F: {format} E: {expect} R: {result}");
            Assert.AreEqual(expect, result);
        }
        public string GetIndicatorText()
        {
            switch (ThermalState)
            {
            case ThermalState.HeatAvailable:
                return(NumberFormatter.FormatNumber(Mathf.CeilToInt(temperature), NumberFormat.Temperature));

            case ThermalState.BatteryAvailable:
                return(NumberFormatter.FormatNumber(Mathf.CeilToInt(this.ThermalChargerMk2.TotalBatteryCharge), NumberFormat.Amount));

            default:
                return(string.Empty);
            }
        }
Пример #6
0
        public string GetIndicatorText()
        {
            switch (SolarState)
            {
            case SolarState.SunAvailable:
                return(NumberFormatter.FormatNumber(Mathf.CeilToInt(solarPercentage), NumberFormat.Sun));

            case SolarState.BatteryAvailable:
                return(NumberFormatter.FormatNumber(Mathf.CeilToInt(this.SolarChargerMk2.TotalBatteryCharge), NumberFormat.Amount));

            default:
                return(string.Empty);
            }
        }
Пример #7
0
        public void Print(object value)
        {
            if (IOUtil.IsNumericType(value.GetType()))
            {
                _buffer.Append(_numberFormatter.FormatNumber(Convert.ToDouble(value)));
                return;
            }
            var str = value.ToString();

            Format(ref str);
            _buffer.Append(str);
            _printedSinceCapsChange = true;
            _prevItem?.OnNextBufferChange();
            _nextItem?.OnPrevBufferChange();
            UpdateSize();
        }
Пример #8
0
        private void AddDisplayText(Site parentSite)
        {
            this.Score.Content    = this.DisplayQuestion.Score;
            this.Views.Content    = NumberFormatter.FormatNumber(this.DisplayQuestion.ViewCount);
            this.Title.Text       = WebUtility.HtmlDecode(this.DisplayQuestion.Title);
            this.Title.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(parentSite.Style.LinkColor));

            foreach (string tag in this.DisplayQuestion.Tags)
            {
                Label tagElement = new Label();
                tagElement.Content         = tag;
                tagElement.Foreground      = new SolidColorBrush((Color)ColorConverter.ConvertFromString(parentSite.Style.TagForegroundColor));
                tagElement.Background      = new SolidColorBrush((Color)ColorConverter.ConvertFromString(parentSite.Style.TagBackgroundColor));
                tagElement.Padding         = new Thickness(5);
                tagElement.Margin          = new Thickness(5, 0, 5, 0);
                tagElement.BorderBrush     = new SolidColorBrush(Colors.LightGray);
                tagElement.BorderThickness = new Thickness(1);
                this.Tags.Children.Add(tagElement);
            }
        }
Пример #9
0
        public void Print(object value)
        {
            string str;

            if (IOUtil.IsNumericType(value.GetType()))
            {
                double num = Convert.ToDouble(value);
                str = NumberFormatter.FormatNumber(num);
                // ReSharper disable once CompareOfFloatsByEqualityOperator
                _sandbox.SetPlural(num != 1.0);
            }
            else
            {
                str = value.ToString();
            }

            Format(ref str);
            _buffer.Append(str);
            PrintedSinceCapsChange = true;
            Prev?.OnNextBufferChange();
            Next?.OnPrevBufferChange();
            UpdateSize();
        }
Пример #10
0
        public void UpdateInfo(IEnumerable <MapTile> selectedMapTiles, RouteManagementViewModel rmVm)
        {
            int nSelected = 0;
            int forests   = 0;
            //double prestige = 1;
            double food         = 1;
            double foodCart     = 1;
            double wood         = 1;
            double woodCart     = 1;
            double science      = 1;
            double scienceCart  = 1;
            double foragingHuts = 1;

            foreach (var hexItem in selectedMapTiles)
            {
                nSelected++;

                if (hexItem.TileType == TileType.Forest)
                {
                    forests++;
                }

                var shrine = hexItem as ShrineTile;

                if (shrine == null)
                {
                    continue;
                }

                //prestige *= shrine.PrestigeMultiplier;
                food         *= shrine.FoodMultiplier;
                foodCart     *= shrine.FoodCartMultiplier;
                wood         *= shrine.WoodMultiplier;
                woodCart     *= shrine.WoodCartMultiplier;
                science      *= shrine.ScienceMultiplier;
                foragingHuts *= shrine.FoodMultiplier * shrine.ForagingHutMultiplier;

                var aMultiplier = shrine.AllCartMultiplier;
                if (aMultiplier > 1)
                {
                    foodCart    *= aMultiplier;
                    woodCart    *= aMultiplier;
                    scienceCart *= aMultiplier;
                }
            }

            var tileCosts = TileCostHelper.Values(nSelected + 2);

            var nextTileCost  = tileCosts[tileCosts.Count - 1];
            var totalTileCost = tileCosts.Sum() - nextTileCost;

            //var prestigeOnReset = nSelected - 9 > 0 ? (nSelected - 9) * prestige : 0;

            NextTileCostText    = (nSelected + 1 < TileCostHelper.KnownValues.Length ? "" : "~") + NumberFormatter.FormatNumber(nextTileCost);
            TileCostTotalText   = (nSelected < TileCostHelper.KnownValues.Length ? "" : "~") + NumberFormatter.FormatNumber(totalTileCost);
            SelectedTilesText   = nSelected.ToString();
            SelectedForestsText = forests.ToString();
            //PrestigeMultiplierText = NumberFormatter.FormatNumber(prestige);
            //PrestigeTotalText = NumberFormatter.FormatNumber(prestigeOnReset);
            FoodMultiplierText        = NumberFormatter.FormatNumber(food);
            FoodCartMultiplierText    = NumberFormatter.FormatNumber(foodCart);
            WoodMultiplierText        = NumberFormatter.FormatNumber(wood);
            WoodCartMultiplierText    = NumberFormatter.FormatNumber(woodCart);
            ScienceMultiplierText     = NumberFormatter.FormatNumber(science);
            ScienceCartMultiplierText = NumberFormatter.FormatNumber(scienceCart);
            ForagingHutMultiplierText = NumberFormatter.FormatNumber(foragingHuts);

            //var averageFoodPerSecond = NumberFormatter.UnformatNumber(rmVm.AverageFoodPerSecondText);


            //var estimateTimeInSeconds = (totalTileCost / averageFoodPerSecond) / 2; // divide by 2 assumed always double production

            //if (double.IsNaN(estimateTimeInSeconds) || estimateTimeInSeconds > 3153600000)
            //{
            //    EstimatedTimeText = "\u221E"; // infinity
            //    PrestigePerSecondText = $"0";
            //}
            //else
            //{
            //    var estimateTimeSpan = TimeSpan.FromSeconds(estimateTimeInSeconds);

            //    if (estimateTimeSpan.Days > 0)
            //    {
            //        EstimatedTimeText = $"{estimateTimeSpan.Days}:{estimateTimeSpan:hh\\:mm} Days";
            //    }
            //    else if (estimateTimeSpan.Hours > 0)
            //    {
            //        EstimatedTimeText = $"{estimateTimeSpan:hh\\:mm} Hours";
            //    }
            //    else
            //    {
            //        EstimatedTimeText = $"{estimateTimeSpan:mm\\:ss} Mins";
            //    }

            //    //var prestigePerSecond = prestigeOnReset / estimateTimeInSeconds;
            //    //PrestigePerSecondText = NumberFormatter.FormatNumber(prestigePerSecond);
            //}

            //if (Math.Min(food, foodCart) != _previousLowestFoodMultiplier)
            //{
            //    averageFoodPerSecond *= Math.Min(food, foodCart) / _previousLowestFoodMultiplier;
            //    _previousLowestFoodMultiplier = Math.Min(food, foodCart);
            //    rmVm.AverageFoodPerSecondText = NumberFormatter.FormatNumber(averageFoodPerSecond);
            //}
        }
 public string GetIndicatorText()
 {
     return(NumberFormatter.FormatNumber(Mathf.CeilToInt(this.NuclearCharger.TotalBatteryCharge), NumberFormat.Amount));
 }
Пример #12
0
Файл: VM.cs Проект: Sloves/Rant
 public string FormatNumber(double value) => _numFormatter.FormatNumber(value);
Пример #13
0
        public void NumberFormat_TestBINNumberFormat(string input, string expected)
        {
            var res = NumberFormatter.FormatNumber(input, 2);

            Assert.Equal(expected, res);
        }
Пример #14
0
 // Update is called once per frame
 void Update()
 {
     upgradeCostDisplay.text = formatter.FormatNumber(GetCost());
 }
 public string GetIndicatorText()
 {
     return(NumberFormatter.FormatNumber(Mathf.CeilToInt(totalBioCharge), NumberFormat.Amount));
 }