levelPercentile() public static method

public static levelPercentile ( int l ) : string
l int
return string
Beispiel #1
0
        public void setNumbers(int levelWild, int levelDom, double valueBreeding, double valueDom)
        {
            // visualization of wild level
            int barLengthPercentage = (int)Math.Min(100, Math.Round(levelWild * (300.0f / (cc != null? cc.maxWildLevel:40))));

            this.panelBarWildLevels.Width = (int)(164 * barLengthPercentage / 100.0f);
            panelBarWildLevels.BackColor  = Utils.getColorFromPercent(barLengthPercentage);
            tt.SetToolTip(panelBarWildLevels, Utils.levelPercentile(levelWild));
            // visualization of dom level
            barLengthPercentage          = (int)Math.Min(100, Math.Round(levelDom * (300.0f / (cc != null? cc.maxWildLevel:40))));
            this.panelBarDomLevels.Width = (int)(164 * barLengthPercentage / 100.0f);
            panelBarDomLevels.BackColor  = Utils.getColorFromPercent(barLengthPercentage);
            if (levelWild < 0)
            {
                labelWildLevel.Text      = "n/a";
                labelWildLevel.ForeColor = Color.LightGray;
            }
            else
            {
                labelWildLevel.Text      = levelWild.ToString();
                labelWildLevel.ForeColor = SystemColors.ControlText;
            }
            labelLevelDom.Text      = levelDom.ToString();
            labelBreedingValue.Text = (Percent ? Math.Round(100 * valueBreeding, 1).ToString("N1") + " %" : valueBreeding.ToString("N1"));
            labelDomValue.Text      = (Percent ? Math.Round(100 * valueDom, 1).ToString("N1") + " %" : valueDom.ToString("N1"));
        }
Beispiel #2
0
        private void numLvW_ValueChanged(object sender, EventArgs e)
        {
            int lengthPercentage = 100 * (int)numLvW.Value / barMaxLevel; // in percentage of the max-barwidth

            if (lengthPercentage > 100)
            {
                lengthPercentage = 100;
            }
            if (lengthPercentage < 0)
            {
                lengthPercentage = 0;
            }
            this.panelBarWildLevels.Width     = lengthPercentage * 283 / 100;
            this.panelBarWildLevels.BackColor = Utils.getColorFromPercent(lengthPercentage);
            tt.SetToolTip(panelBarWildLevels, Utils.levelPercentile((int)numLvW.Value));

            if (inputType != StatIOInputType.FinalValueInputType)
            {
                LevelChanged(this);
            }
        }