private static int drawStatLine(RenderingContext rc, RollValue roll, Rect clientRect, int yPos, bool isImp = false)
        {
            const int leftRuler = 50;
            Color textColor = isImp ? HudSkin.MagicColor : Color.White;

            bool isUniqAffix = roll.AffixType == ModsDat.ModType.Hidden;
            string prefix = isImp ? "[Impl]" : roll.AffixType == ModsDat.ModType.Prefix
                ? "[P]"
                : roll.AffixType == ModsDat.ModType.Suffix ? "[S]" : "[?]";
            if (!isUniqAffix || isImp)
            {
                if( !isImp && roll.CouldHaveTiers())
                    prefix += " T" + roll.Tier + " ";

                rc.AddTextWithHeight(new Vec2(clientRect.X + 5, yPos), prefix, textColor, 8, DrawTextFormat.Left);
                var textSize = rc.AddTextWithHeight(new Vec2(clientRect.X + leftRuler, yPos), roll.AffixText, roll.TextColor, 8,
                    DrawTextFormat.Left);
                yPos += textSize.Y;
            }

            for (int iStat = 0; iStat < 4; iStat++)
            {
                IntRange range = roll.TheMod.StatRange[iStat];
                if(range.Min == 0 && range.Max == 0)
                    continue;

                var theStat = roll.TheMod.StatNames[iStat];
                int val = roll.StatValue[iStat];
                float percents = range.GetPercentage(val);
                bool noSpread = !range.HasSpread();

                double hue = 120 * percents;
                if (noSpread) hue = 300;
                if (percents > 1) hue = 180;

                Color col = ColorUtils.ColorFromHsv(hue, 1, 1);

                string line2 = string.Format(noSpread ? "{0}" : "{0} [{1}]", theStat, range);

                rc.AddTextWithHeight(new Vec2(clientRect.X + leftRuler, yPos), line2, Color.White, 8, DrawTextFormat.Left);

                if( null == theStat) // crazy maps
                    continue;

                string sValue = theStat.ValueToString(val);
                var txSize = rc.AddTextWithHeight(new Vec2(clientRect.X + leftRuler - 5, yPos), sValue,
                    col, 8,
                    DrawTextFormat.Right);

                yPos += txSize.Y;
            }
            return yPos;
        }
Exemple #2
0
        private static int drawStatLine(RenderingContext rc, RollValue item, Rect clientRect, int yPos)
        {
            const int leftRuler = 50;

            bool   isUniqAffix = item.AffixType == ModsDat.ModType.Hidden;
            string prefix      = item.AffixType == ModsDat.ModType.Prefix
                                ? "[P]"
                                : item.AffixType == ModsDat.ModType.Suffix ? "[S]" : "[?]";

            if (!isUniqAffix)
            {
                if (item.CouldHaveTiers())
                {
                    prefix += " T" + item.Tier + " ";
                }

                rc.AddTextWithHeight(new Vec2(clientRect.X + 5, yPos), prefix, Color.White, 8, DrawTextFormat.Left);
                var textSize = rc.AddTextWithHeight(new Vec2(clientRect.X + leftRuler, yPos), item.AffixText, item.TextColor, 8,
                                                    DrawTextFormat.Left);
                yPos += textSize.Y;
            }

            for (int iStat = 0; iStat < 4; iStat++)
            {
                IntRange range = item.TheMod.StatRange[iStat];
                if (range.Min == 0 && range.Max == 0)
                {
                    continue;
                }

                var   theStat  = item.TheMod.StatNames[iStat];
                int   val      = item.StatValue[iStat];
                float percents = range.GetPercentage(val);
                bool  noSpread = !range.HasSpread();

                double hue = 120 * percents;
                if (noSpread)
                {
                    hue = 300;
                }
                if (percents > 1)
                {
                    hue = 180;
                }

                Color col = ColorUtils.ColorFromHsv(hue, 1, 1);

                string line2 = string.Format(noSpread ? "{0}" : "{0} [{1}]", theStat, range);

                rc.AddTextWithHeight(new Vec2(clientRect.X + leftRuler, yPos), line2, Color.White, 8, DrawTextFormat.Left);

                string sValue = theStat.ValueToString(val);
                var    txSize = rc.AddTextWithHeight(new Vec2(clientRect.X + leftRuler - 5, yPos), sValue,
                                                     col, 8,
                                                     DrawTextFormat.Right);



                //if (!isUniqAffix)
                //	rc.AddTextWithHeight(new Vec2(clientRect.X + clientRect.W - 5, yPos), item.AllTiersRange[iStat].ToString(),
                //		Color.White, 8,
                //		DrawTextFormat.Right);
                yPos += txSize.Y;
            }
            return(yPos);
        }