예제 #1
0
        private void unitList_SelectedIndexChanged(object sender, EventArgs e)
        {
            weaponDropdown.SelectedItem = null;
            String selectedUnit = unitList.GetItemText(unitList.SelectedItem);

            if (unitDatabase.setQueryTarget(selectedUnit))
            {
                weaponDropdown.DataSource       = unitDatabase.getWeapons();
                weaponDropdownSimple.DataSource = weaponDropdown.DataSource;

                Weapon lockedWeapon = unitDatabase.tryGetLockIndexedWeapon();
                if (lockedWeapon != null)
                {
                    weaponDropdown.SelectedItem = lockedWeapon;
                }

                // Controls common to all tabs ---
                #region
                priceFieldSimple.Text        = unitDatabase.getPrice();
                priceFieldFirepower.Text     = unitDatabase.getPrice();
                priceFieldRecon.Text         = unitDatabase.getPrice();
                priceFieldMobility.Text      = unitDatabase.getPrice();
                priceFieldSurvivability.Text = unitDatabase.getPrice();

                nameFieldSimple.Text        = unitDatabase.getUnitName();
                nameFieldFirepower.Text     = unitDatabase.getUnitName();
                nameFieldRecon.Text         = unitDatabase.getUnitName();
                nameFieldMobility.Text      = unitDatabase.getUnitName();
                nameFieldSurvivability.Text = unitDatabase.getUnitName();

                if (unitDatabase.isPrototype())
                {
                    prototypeLabelSimple.Show();
                    prototypeLabelFirepower.Show();
                    prototypeLabelRecon.Show();
                    prototypeLabelMobility.Show();
                    prototypeLabelSurvivability.Show();
                }
                else
                {
                    prototypeLabelSimple.Hide();
                    prototypeLabelFirepower.Hide();
                    prototypeLabelRecon.Hide();
                    prototypeLabelMobility.Hide();
                    prototypeLabelSurvivability.Hide();
                }

                unitCardField.Image              = unitDatabase.getUnitCard();
                unitCardFieldFirepower.Image     = unitCardField.Image;
                unitCardFieldRecon.Image         = unitCardField.Image;
                unitCardFieldMobility.Image      = unitCardField.Image;
                unitCardFieldSurvivability.Image = unitCardField.Image;

                // Flag:
                #region
                Bitmap img = null;
                switch (selectedUnit.Substring(0, 3))
                {
                case "ANZ": img = Properties.Resources.ANZAC; break;

                case "CAN": img = Properties.Resources.CAN; break;

                case "CHI": img = Properties.Resources.PRC; break;

                case "DAN": img = Properties.Resources.DEN; break;

                case "FIN": img = Properties.Resources.FIN; break;

                case "FR ": img = Properties.Resources.FRA; break;

                case "HOL": img = Properties.Resources.NED; break;

                case "ISR": img = Properties.Resources.ISR; break;

                case "JAP": img = Properties.Resources.JAP; break;

                case "NK ": img = Properties.Resources.DPRK; break;

                case "NOR": img = Properties.Resources.NOR; break;

                case "POL": img = Properties.Resources.POL; break;

                case "RDA": img = Properties.Resources.DDR; break;

                case "RFA": img = Properties.Resources.BRD; break;

                case "ROK": img = Properties.Resources.ROK; break;

                case "SWE": img = Properties.Resources.SWE; break;

                case "TCH": img = Properties.Resources.CZS; break;

                case "UK ": img = Properties.Resources.UK; break;

                case "URS": img = Properties.Resources.USSR; break;

                case "US ": img = Properties.Resources.USA; break;

                case "YUG": img = Properties.Resources.YU; break;

                default: break;
                }
                flagSimple.Image        = img;
                flagFirepower.Image     = flagSimple.Image;
                flagRecon.Image         = flagSimple.Image;
                flagMobility.Image      = flagSimple.Image;
                flagSurvivability.Image = flagSimple.Image;
                #endregion

                // Availability:
                #region
                String[] availability = unitDatabase.getMaxDeployableAmount();
                bool     hasRookie    = availability[0] != "0";
                bool     hasTrained   = availability[1] != "0";
                bool     hasHardened  = availability[2] != "0";
                bool     hasVeteran   = availability[3] != "0";
                bool     hasElite     = availability[4] != "0";

                if (hasRookie)
                {
                    noRookieImageFirepower.Hide();
                    noRookieImageSimple.Hide();
                    noRookieImageRecon.Hide();
                    noRookieImageMobility.Hide();
                    noRookieImageSurvivability.Hide();

                    yesRookieImageFirepower.Show();
                    yesRookieImageSimple.Show();
                    yesRookieImageRecon.Show();
                    yesRookieImageMobility.Show();
                    yesRookieImageSurvivability.Show();

                    rookieFieldFirepower.Text     = availability[0];
                    rookieFieldSimple.Text        = rookieFieldFirepower.Text;
                    rookieFieldRecon.Text         = rookieFieldFirepower.Text;
                    rookieFieldMobility.Text      = rookieFieldFirepower.Text;
                    rookieFieldSurvivability.Text = rookieFieldFirepower.Text;
                }
                else
                {
                    noRookieImageFirepower.Show();
                    noRookieImageSimple.Show();
                    noRookieImageRecon.Show();
                    noRookieImageMobility.Show();
                    noRookieImageSurvivability.Show();

                    yesRookieImageFirepower.Hide();
                    yesRookieImageSimple.Hide();
                    yesRookieImageRecon.Hide();
                    yesRookieImageMobility.Hide();
                    yesRookieImageSurvivability.Hide();

                    rookieFieldFirepower.Text     = "";
                    rookieFieldSimple.Text        = rookieFieldFirepower.Text;
                    rookieFieldRecon.Text         = rookieFieldFirepower.Text;
                    rookieFieldMobility.Text      = rookieFieldFirepower.Text;
                    rookieFieldSurvivability.Text = rookieFieldFirepower.Text;
                }
                if (hasTrained)
                {
                    noTrainedImageFirepower.Hide();
                    noTrainedImageSimple.Hide();
                    noTrainedImageRecon.Hide();
                    noTrainedImageMobility.Hide();
                    noTrainedImageSurvivability.Hide();

                    yesTrainedImageFirepower.Show();
                    yesTrainedImageSimple.Show();
                    yesTrainedImageRecon.Show();
                    yesTrainedImageMobility.Show();
                    yesTrainedImageSurvivability.Show();

                    trainedFieldFirepower.Text     = availability[1];
                    trainedFieldSimple.Text        = trainedFieldFirepower.Text;
                    trainedFieldRecon.Text         = trainedFieldFirepower.Text;
                    trainedFieldMobility.Text      = trainedFieldFirepower.Text;
                    trainedFieldSurvivability.Text = trainedFieldFirepower.Text;
                }
                else
                {
                    noTrainedImageFirepower.Show();
                    noTrainedImageSimple.Show();
                    noTrainedImageRecon.Show();
                    noTrainedImageMobility.Show();
                    noTrainedImageSurvivability.Show();

                    yesTrainedImageFirepower.Hide();
                    yesTrainedImageSimple.Hide();
                    yesTrainedImageRecon.Hide();
                    yesTrainedImageMobility.Hide();
                    yesTrainedImageSurvivability.Hide();

                    trainedFieldFirepower.Text     = "";
                    trainedFieldSimple.Text        = trainedFieldFirepower.Text;
                    trainedFieldRecon.Text         = trainedFieldFirepower.Text;
                    trainedFieldMobility.Text      = trainedFieldFirepower.Text;
                    trainedFieldSurvivability.Text = trainedFieldFirepower.Text;
                }
                if (hasHardened)
                {
                    noHardenedImageFirepower.Hide();
                    noHardenedImageSimple.Hide();
                    noHardenedImageRecon.Hide();
                    noHardenedImageMobility.Hide();
                    noHardenedImageSurvivability.Hide();

                    yesHardenedImageFirepower.Show();
                    yesHardenedImageSimple.Show();
                    yesHardenedImageRecon.Show();
                    yesHardenedImageMobility.Show();
                    yesHardenedImageSurvivability.Show();

                    hardenedFieldFirepower.Text     = availability[2];
                    hardenedFieldSimple.Text        = hardenedFieldFirepower.Text;
                    hardenedFieldRecon.Text         = hardenedFieldFirepower.Text;
                    hardenedFieldMobility.Text      = hardenedFieldFirepower.Text;
                    hardenedFieldSurvivability.Text = hardenedFieldFirepower.Text;
                }
                else
                {
                    noHardenedImageFirepower.Show();
                    noHardenedImageSimple.Show();
                    noHardenedImageRecon.Show();
                    noHardenedImageMobility.Show();
                    noHardenedImageSurvivability.Show();

                    yesHardenedImageFirepower.Hide();
                    yesHardenedImageSimple.Hide();
                    yesHardenedImageRecon.Hide();
                    yesHardenedImageMobility.Hide();
                    yesHardenedImageSurvivability.Hide();

                    hardenedFieldFirepower.Text     = "";
                    hardenedFieldSimple.Text        = hardenedFieldFirepower.Text;
                    hardenedFieldRecon.Text         = hardenedFieldFirepower.Text;
                    hardenedFieldMobility.Text      = hardenedFieldFirepower.Text;
                    hardenedFieldSurvivability.Text = hardenedFieldFirepower.Text;
                }
                if (hasVeteran)
                {
                    noVeteranImageFirepower.Hide();
                    noVeteranImageSimple.Hide();
                    noVeteranImageRecon.Hide();
                    noVeteranImageMobility.Hide();
                    noVeteranImageSurvivability.Hide();

                    yesVeteranImageFirepower.Show();
                    yesVeteranImageSimple.Show();
                    yesVeteranImageRecon.Show();
                    yesVeteranImageMobility.Show();
                    yesVeteranImageSurvivability.Show();

                    veteranFieldFirepower.Text     = availability[3];
                    veteranFieldSimple.Text        = veteranFieldFirepower.Text;
                    veteranFieldRecon.Text         = veteranFieldFirepower.Text;
                    veteranFieldMobility.Text      = veteranFieldFirepower.Text;
                    veteranFieldSurvivability.Text = veteranFieldFirepower.Text;
                }
                else
                {
                    noVeteranImageFirepower.Show();
                    noVeteranImageSimple.Show();
                    noVeteranImageRecon.Show();
                    noVeteranImageMobility.Show();
                    noVeteranImageSurvivability.Show();

                    yesVeteranImageFirepower.Hide();
                    yesVeteranImageSimple.Hide();
                    yesVeteranImageRecon.Hide();
                    yesVeteranImageMobility.Hide();
                    yesVeteranImageSurvivability.Hide();

                    veteranFieldFirepower.Text     = "";
                    veteranFieldSimple.Text        = veteranFieldFirepower.Text;
                    veteranFieldRecon.Text         = veteranFieldFirepower.Text;
                    veteranFieldMobility.Text      = veteranFieldFirepower.Text;
                    veteranFieldSurvivability.Text = veteranFieldFirepower.Text;
                }
                if (hasElite)
                {
                    noEliteImageFirepower.Hide();
                    noEliteImageSimple.Hide();
                    noEliteImageRecon.Hide();
                    noEliteImageMobility.Hide();
                    noEliteImageSurvivability.Hide();

                    yesEliteImageFirepower.Show();
                    yesEliteImageSimple.Show();
                    yesEliteImageRecon.Show();
                    yesEliteImageMobility.Show();
                    yesEliteImageSurvivability.Show();

                    eliteFieldFirepower.Text     = availability[4];
                    eliteFieldSimple.Text        = eliteFieldFirepower.Text;
                    eliteFieldRecon.Text         = eliteFieldFirepower.Text;
                    eliteFieldMobility.Text      = eliteFieldFirepower.Text;
                    eliteFieldSurvivability.Text = eliteFieldFirepower.Text;
                }
                else
                {
                    noEliteImageFirepower.Show();
                    noEliteImageSimple.Show();
                    noEliteImageRecon.Show();
                    noEliteImageMobility.Show();
                    noEliteImageSurvivability.Show();

                    yesEliteImageFirepower.Hide();
                    yesEliteImageSimple.Hide();
                    yesEliteImageRecon.Hide();
                    yesEliteImageMobility.Hide();
                    yesEliteImageSurvivability.Hide();

                    eliteFieldFirepower.Text     = "";
                    eliteFieldSimple.Text        = eliteFieldFirepower.Text;
                    eliteFieldRecon.Text         = eliteFieldFirepower.Text;
                    eliteFieldMobility.Text      = eliteFieldFirepower.Text;
                    eliteFieldSurvivability.Text = eliteFieldFirepower.Text;
                }
                #endregion

                // END common controls --------------
                #endregion

                // Controls from Survivability tab ------
                #region
                topArmorField.Text                            = unitDatabase.getTopArmor();
                sideArmorField.Text                           = unitDatabase.getSideArmor();
                rearArmorField.Text                           = unitDatabase.getRearArmor();
                frontArmorField.Text                          = unitDatabase.getFrontArmor();
                healthField.Text                              = unitDatabase.getHealth();
                ecmField.Text                                 = unitDatabase.getECM();
                sizeField.Text                                = unitDatabase.getSize();
                maxSuppressionDamagesField.Text               = unitDatabase.getMaxSuppressionDamages();
                stunDamagesRegenField.Text                    = unitDatabase.getStunDamagesRegen();
                stunDamagesToGetStunnedField.Text             = unitDatabase.getStunDamagesToGetStunned();
                suppressDamagesRegenRatioField.Text           = unitDatabase.getSuppressDamagesRegenRatio();
                suppressDamagesRegenRatioOutOfRangeField.Text = unitDatabase.getSuppressDamagesRegenRatioOutOfRange();

                // suppression effects
                paliersSuppressDamagesField.Text        = unitDatabase.getPaliersSuppressDamages();
                infAndCanonSpeedModifierField.Text      = unitDatabase.getSuppressDamagesInfAndCanonSpeedModifier();
                infAndCanonDispersionModifierField.Text = unitDatabase.getSuppressDamagesInfAndCanonDispersionModifier();
                infDamagesMultiplierField.Text          = unitDatabase.getSuppressDamagesInfDamagesMultiplier();
                infFiringRateMultiplierField.Text       = unitDatabase.getSuppressDamagesInfFiringRateMultiplier();
                canonFiringRateMultiplierField.Text     = unitDatabase.getSuppressDamagesCanonFiringRateMultiplier();
                vehiculeFiringRateMultiplierField.Text  = unitDatabase.getSuppressDamagesVehiculeFiringRateMultiplier();
                vehiculeDispersionMultiplierField.Text  = unitDatabase.getSuppressDamagesVehiculeDispersionMultiplier();
                artilleryDispersionMultiplierField.Text = unitDatabase.getSuppressDamagesArtilleryDispersionMultiplier();
                hitModifierField.Text = unitDatabase.getSuppressDamagesHitModifier();

                // physical damage effects
                paliersPhysicalDamagesField.Text     = unitDatabase.getPaliersPhysicalDamages();
                cannonFiringRateMultiplierField.Text = unitDatabase.getPhysicalDamagesCannonFiringRateMultiplier();
                vehiculeSpeedField.Text        = unitDatabase.getPhysicalDamagesVehiculeSpeedModifier();
                vehiculeFiringRateField.Text   = unitDatabase.getPhysicalDamagesVehiculeFiringRateMultiplier();
                chassisRotationSpeedField.Text = unitDatabase.getPhysicalDamagesVehiculeChassisRotationSpeedModifier();
                turretRotationSpeedField.Text  = unitDatabase.getPhysicalDamagesVehiculeTurretRotationSpeedModifier();
                // END Survivability controls -----------
                #endregion

                // Controls from Recon tab ----------
                #region
                groundOpticsField.Text = unitDatabase.getGroundOptics();
                airOpticsField.Text    = unitDatabase.getAirOptics();
                timeBetweenEachIdentifyRollField.Text = unitDatabase.getTimeBetweenEachIdentifyRoll();
                identifyBaseProbabilityField.Text     = unitDatabase.getIdentifyBaseProbability();
                stealthField.Text                  = unitDatabase.getStealth();
                detectionTbaField.Text             = unitDatabase.getAntiheloSpottingCap();
                porteeVisionField.Text             = unitDatabase.getAntigroundSpottingCap();
                porteeVisionTbaField.Text          = unitDatabase.getAntigroundSpottingCapWhileFlying();
                opticalStrengthAntiRadarField.Text = unitDatabase.getOpticalStrengthAntiRadar();
                unitTypeField.Text                 = unitDatabase.getUnitType();
                killExperienceBonusField.Text      = unitDatabase.getKillExperienceBonus();
                specializedDetection4Field.Text    = unitDatabase.getAntiplaneSpottingCap();
                // END recon controls ---------------
                #endregion

                // Controls from mobility tab -------
                #region
                speedField.Text           = unitDatabase.getSpeed();
                fuelField.Text            = unitDatabase.getFuel();
                autonomyField.Text        = unitDatabase.getAutonomy();
                tempsDemiTourField.Text   = unitDatabase.getTempsDemiTour();
                maxAccelerationField.Text = unitDatabase.getMaxAcceleration();
                maxDecelerationField.Text = unitDatabase.getMaxDeceleration();
                unitMovingTypeField.Text  = unitDatabase.getUnitMovingType();
                vehicleSubTypeField.Text  = unitDatabase.getVehicleSubType();
                suppressDamageRatioIfTransporterKilledField.Text = unitDatabase.getSuppressDamageRatioIfTransporterKilled();
                wreckUnloadPhysicalDamageBonusField.Text         = unitDatabase.getWreckUnloadPhysicalDamageBonus();
                wreckUnloadStunDamageBonusField.Text             = unitDatabase.getWreckUnloadStunDamageBonus();
                wreckUnloadSuppressDamageBonusField.Text         = unitDatabase.getWreckUnloadSuppressDamageBonus();
                flyingAltitudeField.Text            = unitDatabase.getFlyingAltitude();
                minimalAltitudeField.Text           = unitDatabase.getMinimalAltitude();
                supplyCapacityField.Text            = unitDatabase.getSupplyCapacity();
                lowAltitudeFlyingAltitudeField.Text = unitDatabase.getLowAltitudeFlyingAltitude();
                nearGroundFlyingAltitudeField.Text  = unitDatabase.getNearGroundFlyingAltitude();
                // END mobility controls ------------
                #endregion


                // Controls from simple tab ---------
                #region
                healthFieldSimple.Text         = healthField.Text;
                groundOpticsFieldSimple.Text   = groundOpticsField.Text;
                airOpticsFieldSimple.Text      = airOpticsField.Text;
                stealthFieldSimple.Text        = stealthField.Text;
                ecmFieldSimple.Text            = ecmField.Text;
                sizeFieldSimple.Text           = sizeField.Text;
                speedFieldSimple.Text          = speedField.Text;
                autonomyFieldSimple.Text       = autonomyField.Text;
                frontArmorFieldSimple.Text     = frontArmorField.Text;
                sideArmorFieldSimple.Text      = sideArmorField.Text;
                rearArmorFieldSimple.Text      = rearArmorField.Text;
                topArmorFieldSimple.Text       = topArmorField.Text;
                altitudeFieldSimple.Text       = flyingAltitudeField.Text;
                supplyCapacityFieldSimple.Text = supplyCapacityField.Text;
                // END simple controls --------------
                #endregion
            }

            else
            {
                Program.warning("The unit you selected was not found. This should never happen.");
            }
        }