Exemplo n.º 1
0
        private void GetMineralBlipSprtCacheProps()
        {
            // Get the min/max values
            double minDollars = double.MaxValue;
            double maxDollars = double.MinValue;

            SortedList <MineralType, double> dollars = new SortedList <MineralType, double>();

            foreach (MineralType mineralType in Enum.GetValues(typeof(MineralType)))
            {
                if (mineralType == MineralType.Custom)
                {
                    continue;
                }

                decimal suggestedDollars       = Mineral.GetSuggestedValue(mineralType);
                double  suggestedDollarsScaled = Math.Sqrt(Convert.ToDouble(suggestedDollars));   // taking the square root, because the values are exponential, and I want the color scale more linear
                dollars.Add(mineralType, suggestedDollarsScaled);

                if (suggestedDollarsScaled < minDollars)
                {
                    minDollars = suggestedDollarsScaled;
                }

                if (suggestedDollarsScaled > maxDollars)
                {
                    maxDollars = suggestedDollarsScaled;
                }
            }

            // Store color based on those values
            _mineralColors = new SortedList <MineralType, MineralBlipProps>();
            Color maxColor = Colors.Chartreuse;

            foreach (MineralType mineralType in Enum.GetValues(typeof(MineralType)))
            {
                MineralBlipProps props = new MineralBlipProps();

                if (mineralType == MineralType.Custom)
                {
                    props.DiffuseColor  = Colors.HotPink;     // not sure what to do here.  maybe I'll know more if I ever use custom minerals  :)
                    props.SpecularColor = props.DiffuseColor;
                    props.Size          = 4;
                }
                else
                {
                    double dollar = dollars[mineralType];

                    double colorPercent = UtilityCore.GetScaledValue_Capped(.33d, 1d, minDollars, maxDollars, dollar);
                    props.DiffuseColor  = UtilityWPF.AlphaBlend(maxColor, Colors.Transparent, colorPercent);
                    props.SpecularColor = props.DiffuseColor;

                    props.Size = UtilityCore.GetScaledValue_Capped(2d, 5d, minDollars, maxDollars, dollar);
                }

                _mineralColors.Add(mineralType, props);
            }
        }
Exemplo n.º 2
0
 public decimal GetMineralValue(MineralType mineralType)
 {
     //TODO:  Slowly adjust my prices from the norm over time (maybe even have my own cargo bay that holds minerals)
     return(Mineral.GetSuggestedValue(mineralType));
 }