Пример #1
0
        public void GenerateAttackDetails()
        {
            if (ActiveWeapon.Count == 0 || ActivePawn == null)
            {
                return;
            }

            float activeValue = 0f;
            float projValue   = 0f;

            isProjected = ProjectedItem != null && ProjectedItem.def.IsWeapon;
            if (isProjected)
            {
                isRangeMeleeMix = ActiveWeapon[0].def.IsRangedWeapon != ProjectedItem.def.IsRangedWeapon;
                isRanged        = ProjectedItem.def.IsRangedWeapon;
            }
            else
            {
                isRangeMeleeMix = false;
                isRanged        = ActiveWeapon[0].def.IsRangedWeapon;
            }

            Widgets.Label(new Rect(x, y, OffensiveStatsRect.width, LabelSpacing), "" + ActiveWeapon[0].LabelCap);
            y += LabelSpacing;

            if (isRanged)
            {
                PrintStatName("Damage");
                activeValue = Equipment_Ranged_Calculators.Damage(ActiveWeapon[0].def);
                PrintActiveStat(PrintRectActiveOffensive(), activeValue);
                if (isProjected)
                {
                    projValue = Equipment_Ranged_Calculators.Damage(ProjectedItem.def);
                }
                PrintProjectedStat(PrintRectProjOffensive(), activeValue, projValue);
                y += LabelSpacing;

                PrintStatName("Warmup");
                activeValue = Equipment_Ranged_Calculators.Warmup(ActiveWeapon[0].def);
                PrintActiveStat(PrintRectActiveOffensive(), activeValue);
                if (isProjected)
                {
                    projValue = Equipment_Ranged_Calculators.Warmup(ProjectedItem.def);
                }
                // Lower the Better
                PrintProjectedStat(PrintRectProjOffensive(), activeValue, projValue, true);
                y += LabelSpacing;

                PrintStatName("Cooldown");
                activeValue = Equipment_Ranged_Calculators.Cooldown(ActiveWeapon[0]);
                PrintActiveStat(PrintRectActiveOffensive(), activeValue);
                if (isProjected)
                {
                    projValue = Equipment_Ranged_Calculators.Cooldown(ProjectedItem);
                }
                // Lower the Better
                PrintProjectedStat(PrintRectProjOffensive(), activeValue, projValue, true);
                y += LabelSpacing;

                PrintStatName("BurstShotCount");
                activeValue = Equipment_Ranged_Calculators.BurstShotCount(ActiveWeapon[0].def);
                PrintActiveStat(PrintRectActiveOffensive(), activeValue);
                if (isProjected)
                {
                    projValue = Equipment_Ranged_Calculators.BurstShotCount(ProjectedItem.def);
                }
                PrintProjectedStat(PrintRectProjOffensive(), activeValue, projValue);
                y += LabelSpacing;

                PrintStatName("Average DPS Short Range");
                activeValue = Equipment_Ranged_Calculators.AverageShortDPS(ActiveWeapon[0]);
                PrintActiveStat(PrintRectActiveOffensive(), activeValue);
                if (isProjected)
                {
                    projValue = Equipment_Ranged_Calculators.AverageShortDPS(ProjectedItem);
                }
                PrintProjectedStat(PrintRectProjOffensive(), activeValue, projValue);
                y += LabelSpacing;

                PrintStatName("Average DPS Medium Range");
                activeValue = Equipment_Ranged_Calculators.AverageMediumDPS(ActiveWeapon[0]);
                PrintActiveStat(PrintRectActiveOffensive(), activeValue);
                if (isProjected)
                {
                    projValue = Equipment_Ranged_Calculators.AverageMediumDPS(ProjectedItem);
                }
                PrintProjectedStat(PrintRectProjOffensive(), activeValue, projValue);
                y += LabelSpacing;

                PrintStatName("Average DPS Long Range");
                activeValue = Equipment_Ranged_Calculators.AverageLongDPS(ActiveWeapon[0]);
                PrintActiveStat(PrintRectActiveOffensive(), activeValue);
                if (isProjected)
                {
                    projValue = Equipment_Ranged_Calculators.AverageLongDPS(ProjectedItem);
                }
                PrintProjectedStat(PrintRectProjOffensive(), activeValue, projValue);
                y += LabelSpacing;

                PrintStatName("Average Damage Per Second");
                activeValue = Equipment_Ranged_Calculators.AverageDPS(ActiveWeapon[0]);
                PrintActiveStat(PrintRectActiveOffensive(), activeValue);
                if (isProjected)
                {
                    projValue = Equipment_Ranged_Calculators.AverageDPS(ProjectedItem);
                }
                PrintProjectedStat(PrintRectProjOffensive(), activeValue, projValue);
                y += LabelSpacing;

                PrintStatName("Accuracy Touch");
                activeValue = Equipment_Ranged_Calculators.AccuracyTouch(ActiveWeapon[0]);
                PrintActiveStat(PrintRectActiveOffensive(), activeValue, true);
                if (isProjected)
                {
                    projValue = Equipment_Ranged_Calculators.AccuracyTouch(ProjectedItem);
                }
                PrintProjectedStat(PrintRectProjOffensive(), activeValue, projValue, false, true);
                y += LabelSpacing;

                PrintStatName("Accuracy Short");
                activeValue = Equipment_Ranged_Calculators.AccuracyShort(ActiveWeapon[0]);
                PrintActiveStat(PrintRectActiveOffensive(), activeValue, true);
                if (isProjected)
                {
                    projValue = Equipment_Ranged_Calculators.AccuracyShort(ProjectedItem);
                }
                PrintProjectedStat(PrintRectProjOffensive(), activeValue, projValue, false, true);
                y += LabelSpacing;

                PrintStatName("Accuracy Medium");
                activeValue = Equipment_Ranged_Calculators.AccuracyMedium(ActiveWeapon[0]);
                PrintActiveStat(PrintRectActiveOffensive(), activeValue, true);
                if (isProjected)
                {
                    projValue = Equipment_Ranged_Calculators.AccuracyMedium(ProjectedItem);
                }
                PrintProjectedStat(PrintRectProjOffensive(), activeValue, projValue, false, true);
                y += LabelSpacing;

                PrintStatName("Accuracy Long");
                activeValue = Equipment_Ranged_Calculators.AccuracyLong(ActiveWeapon[0]);
                PrintActiveStat(PrintRectActiveOffensive(), activeValue, true);
                if (isProjected)
                {
                    projValue = Equipment_Ranged_Calculators.AccuracyLong(ProjectedItem);
                }
                PrintProjectedStat(PrintRectProjOffensive(), activeValue, projValue, false, true);
                y += LabelSpacing;
            }
            else
            {
                PrintStatName("Damage");
                activeValue = Equipment_Melee_Calculators.Damage(ActivePawn, ActiveWeapon[0]);
                PrintActiveStat(PrintRectActiveOffensive(), activeValue);
                if (isProjected)
                {
                    projValue = Equipment_Melee_Calculators.Damage(ActivePawn, ProjectedItem);
                }
                PrintProjectedStat(PrintRectProjOffensive(), activeValue, projValue);
                y += LabelSpacing;

                PrintStatName("Warmup");
                activeValue = Equipment_Melee_Calculators.Warmup(ActiveWeapon[0].def);
                PrintActiveStat(PrintRectActiveOffensive(), activeValue);
                if (isProjected)
                {
                    projValue = Equipment_Melee_Calculators.Warmup(ProjectedItem.def);
                }
                PrintProjectedStat(PrintRectProjOffensive(), activeValue, projValue);

                y += LabelSpacing;

                PrintStatName("Cooldown");
                activeValue = Equipment_Melee_Calculators.Cooldown(ActiveWeapon[0]);
                PrintActiveStat(PrintRectActiveOffensive(), activeValue);
                if (isProjected)
                {
                    projValue = Equipment_Melee_Calculators.Cooldown(ProjectedItem);
                }
                PrintProjectedStat(PrintRectProjOffensive(), activeValue, projValue);

                y += LabelSpacing;

                PrintStatName("Damage Per Second");
                activeValue = Equipment_Melee_Calculators.DPS(ActivePawn, ActiveWeapon[0]);
                PrintActiveStat(PrintRectActiveOffensive(), activeValue);
                if (isProjected)
                {
                    projValue = Equipment_Melee_Calculators.DPS(ActivePawn, ProjectedItem);
                }
                PrintProjectedStat(PrintRectProjOffensive(), activeValue, projValue);
                y += LabelSpacing;
            }

            SetInitialWindowSettings();
        }
Пример #2
0
        public void CreateAttributeTextures(Rect storageBox, Thing item)
        {
            float itemVal;
            float activeVal;
            float texSize = 20f;
            float localX  = 0;

            if (ActiveWeapon.Count == 0)
            {
                return;
            }

            if (item.def.IsRangedWeapon && ActiveWeapon[0].def.IsRangedWeapon)
            {
                itemVal   = Equipment_Ranged_Calculators.AverageDPS(item);
                activeVal = Equipment_Ranged_Calculators.AverageDPS(ActiveWeapon[0]);
                if (itemVal > activeVal)
                {
                    // Green damage texture
                    GUI.DrawTexture(new Rect(storageBox.x + storageBox.width - texSize - 1f, storageBox.y + 1, texSize, texSize), DamageTextureGreen);
                    localX += texSize + 1;
                }
                else if (itemVal < activeVal)
                {
                    // Red Damage texture
                    GUI.DrawTexture(new Rect(storageBox.x + storageBox.width - texSize - 1f, storageBox.y + 1, texSize, texSize), DamageTextureRed);
                    localX += texSize + 1;
                }

                itemVal   = Equipment_Ranged_Calculators.AverageAccuracy(item);
                activeVal = Equipment_Ranged_Calculators.AverageAccuracy(ActiveWeapon[0]);
                if (itemVal > activeVal)
                {
                    // Green Accuracy texture
                    GUI.DrawTexture(new Rect(storageBox.x + storageBox.width - texSize - 1f - localX, storageBox.y + 1, texSize, texSize), AccuracyTextureGreen);
                    localX += texSize + 1;
                }
                else if (itemVal < activeVal)
                {
                    // Red Accuracy texture
                    GUI.DrawTexture(new Rect(storageBox.x + storageBox.width - texSize - 1f - localX, storageBox.y + 1, texSize, texSize), AccuracyTextureRed);
                    localX += texSize + 1;
                }
            }
            else if (item.def.IsApparel)
            {
            }
            else if (item.def.IsMeleeWeapon && ActiveWeapon[0].def.IsMeleeWeapon)
            {
                itemVal   = Equipment_Melee_Calculators.DPS(ActivePawn, item);
                activeVal = Equipment_Melee_Calculators.DPS(ActivePawn, ActiveWeapon[0]);
                if (itemVal > activeVal)
                {
                    // Green damage texture
                    GUI.DrawTexture(new Rect(storageBox.x + storageBox.width - texSize - 1f, storageBox.y + 1, texSize, texSize), DamageTextureGreen);
                    localX += texSize + 1;
                }
                else if (itemVal < activeVal)
                {
                    // Red Damage texture
                    GUI.DrawTexture(new Rect(storageBox.x + storageBox.width - texSize - 1f, storageBox.y + 1, texSize, texSize), DamageTextureRed);
                    localX += texSize + 1;
                }

                itemVal   = Equipment_Melee_Calculators.Cooldown(item);
                activeVal = Equipment_Melee_Calculators.Cooldown(ActiveWeapon[0]);
                if (itemVal > activeVal)
                {
                    // Green damage texture
                    GUI.DrawTexture(new Rect(storageBox.x + storageBox.width - texSize - 1f - localX, storageBox.y + 1, texSize, texSize), AccuracyTextureGreen);
                    localX += texSize + 1;
                }
                else if (itemVal < activeVal)
                {
                    // Red Damage texture
                    GUI.DrawTexture(new Rect(storageBox.x + storageBox.width - texSize - 1f - localX, storageBox.y + 1, texSize, texSize), AccuracyTextureRed);
                    localX += texSize + 1;
                }
            }
        }