当前位置: 首页>>代码示例>>C#>>正文


C# VehicleMod.Create方法代码示例

本文整理汇总了C#中VehicleMod.Create方法的典型用法代码示例。如果您正苦于以下问题:C# VehicleMod.Create方法的具体用法?C# VehicleMod.Create怎么用?C# VehicleMod.Create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在VehicleMod的用法示例。


在下文中一共展示了VehicleMod.Create方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: cmdDeleteVehicle_Click

        private void cmdDeleteVehicle_Click(object sender, EventArgs e)
        {
            // Delete the selected Vehicle.
            try
            {
                if (treVehicles.SelectedNode.Level == 0)
                    return;
            }
            catch
            {
                return;
            }

            if (treVehicles.SelectedNode.Level != 2)
            {
                if (!_objFunctions.ConfirmDelete(LanguageManager.Instance.GetString("Message_DeleteVehicle")))
                    return;
            }

            if (treVehicles.SelectedNode.Level == 1)
            {
                // Locate the Vehicle that is selected in the tree.
                Vehicle objVehicle = _objFunctions.FindVehicle(treVehicles.SelectedNode.Tag.ToString(), _objCharacter.Vehicles);

                // Remove any Gear Improvements from the character (primarily those provided by an Emotitoy).
                foreach (Gear objGear in objVehicle.Gear)
                    _objImprovementManager.RemoveImprovements(Improvement.ImprovementSource.Gear, objGear.InternalId);

                _objCharacter.Vehicles.Remove(objVehicle);
                treVehicles.SelectedNode.Remove();
            }
            else if (treVehicles.SelectedNode.Level == 2)
            {
                bool blnFound = false;
                // Locate the VehicleMod that is selected in the tree.
                Vehicle objFoundVehicle = new Vehicle(_objCharacter);
                VehicleMod objMod = _objFunctions.FindVehicleMod(treVehicles.SelectedNode.Tag.ToString(), _objCharacter.Vehicles, out objFoundVehicle);
                if (objMod != null)
                {
                    blnFound = true;

                    if (!_objFunctions.ConfirmDelete(LanguageManager.Instance.GetString("Message_DeleteVehicle")))
                        return;

                    // Check for Improved Sensor bonus.
                    if (objMod.Bonus != null)
                    {
                        if (objMod.Bonus["improvesensor"] != null)
                        {
                            ChangeVehicleSensor(objFoundVehicle, false);
                        }
                    }

                    // If this is the Obsolete Mod, the user must select a percentage. This will create an Expense that costs X% of the Vehicle's base cost to remove the special Obsolete Mod.
                    if (objMod.Name == "Obsolete" || (objMod.Name == "Obsolescent" && _objOptions.AllowObsolescentUpgrade))
                    {
                        frmSelectNumber frmModPercent = new frmSelectNumber();
                        frmModPercent.Minimum = 0;
                        frmModPercent.Maximum = 1000;
                        frmModPercent.Description = LanguageManager.Instance.GetString("String_Retrofit");
                        frmModPercent.ShowDialog(this);

                        if (frmModPercent.DialogResult == DialogResult.Cancel)
                            return;

                        int intPercentage = frmModPercent.SelectedValue;
                        int intVehicleCost = Convert.ToInt32(objFoundVehicle.Cost);

                        // Make sure the character has enough Nuyen for the expense.
                        int intCost = Convert.ToInt32(Convert.ToDouble(intVehicleCost, GlobalOptions.Instance.CultureInfo) * (Convert.ToDouble(intPercentage, GlobalOptions.Instance.CultureInfo) / 100.0), GlobalOptions.Instance.CultureInfo);
                        VehicleMod objRetrofit = new VehicleMod(_objCharacter);

                        XmlDocument objVehiclesDoc = XmlManager.Instance.Load("vehicles.xml");
                        XmlNode objXmlNode = objVehiclesDoc.SelectSingleNode("/chummer/mods/mod[name = \"Retrofit\"]");
                        TreeNode objTreeNode = new TreeNode();
                        objRetrofit.Create(objXmlNode, objTreeNode, 0);
                        objRetrofit.Cost = intCost.ToString();
                        objFoundVehicle.Mods.Add(objRetrofit);
                        treVehicles.SelectedNode.Parent.Nodes.Add(objTreeNode);
                    }

                    objFoundVehicle.Mods.Remove(objMod);
                    treVehicles.SelectedNode.Remove();
                }

                if (!blnFound)
                {
                    // Locate the Sensor or Ammunition that is selected in the tree.
                    foreach (Vehicle objCharacterVehicle in _objCharacter.Vehicles)
                    {
                        foreach (Gear objGear in objCharacterVehicle.Gear)
                        {
                            if (objGear.InternalId == treVehicles.SelectedNode.Tag.ToString())
                            {
                                if (!_objFunctions.ConfirmDelete(LanguageManager.Instance.GetString("Message_DeleteVehicle")))
                                    return;

                                // Remove the Gear Weapon created by the Gear if applicable.
                                if (objGear.WeaponID != Guid.Empty.ToString())
                                {
//.........这里部分代码省略.........
开发者ID:cormanater,项目名称:chummer5a,代码行数:101,代码来源:frmCreate.cs

示例2: tsVehicleAddMod_Click

        private void tsVehicleAddMod_Click(object sender, EventArgs e)
        {
            // Make sure a parent items is selected, then open the Select Vehicle Mod window.
            try
            {
                if (treVehicles.SelectedNode.Level == 0)
                {
                    MessageBox.Show(LanguageManager.Instance.GetString("Message_SelectVehicle"), LanguageManager.Instance.GetString("MessageTitle_SelectVehicle"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }
            catch
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_SelectVehicle"), LanguageManager.Instance.GetString("MessageTitle_SelectVehicle"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (treVehicles.SelectedNode.Level > 1)
                treVehicles.SelectedNode = treVehicles.SelectedNode.Parent;

            Vehicle objSelectedVehicle = _objFunctions.FindVehicle(treVehicles.SelectedNode.Tag.ToString(), _objCharacter.Vehicles);

            frmSelectVehicleMod frmPickVehicleMod = new frmSelectVehicleMod(_objCharacter);
            // Set the Vehicle properties for the window.
            frmPickVehicleMod.VehicleCost = Convert.ToInt32(objSelectedVehicle.Cost);
            frmPickVehicleMod.Body = objSelectedVehicle.TotalBody;
			frmPickVehicleMod.Seats = objSelectedVehicle.Seats;
			frmPickVehicleMod.Handling = objSelectedVehicle.Handling;
			frmPickVehicleMod.Speed = objSelectedVehicle.Speed;
            frmPickVehicleMod.Accel = objSelectedVehicle.Accel;
            frmPickVehicleMod.DeviceRating = objSelectedVehicle.DeviceRating;
            frmPickVehicleMod.HasModularElectronics = objSelectedVehicle.HasModularElectronics();

            frmPickVehicleMod.ShowDialog(this);

            // Make sure the dialogue window was not canceled.
            if (frmPickVehicleMod.DialogResult == DialogResult.Cancel)
                return;

            // Open the Vehicles XML file and locate the selected piece.
            XmlDocument objXmlDocument = XmlManager.Instance.Load("vehicles.xml");

            XmlNode objXmlMod = objXmlDocument.SelectSingleNode("/chummer/mods/mod[name = \"" + frmPickVehicleMod.SelectedMod + "\"]");

            TreeNode objNode = new TreeNode();
            VehicleMod objMod = new VehicleMod(_objCharacter);
            objMod.Create(objXmlMod, objNode, frmPickVehicleMod.SelectedRating);

            // Make sure that the Armor Rating does not exceed the maximum allowed by the Vehicle.
            if (objMod.Name.StartsWith("Armor"))
            {
                if (objMod.Rating > objSelectedVehicle.MaxArmor)
                {
                    objMod.Rating = objSelectedVehicle.MaxArmor;
                    objNode.Text = objMod.DisplayName;
                }
            }

            objSelectedVehicle.Mods.Add(objMod);

            objNode.ContextMenuStrip = cmsVehicle;
            treVehicles.SelectedNode.Nodes.Add(objNode);
            treVehicles.SelectedNode.Expand();
            RefreshSelectedVehicle();

            // Check for Improved Sensor bonus.
            if (objMod.Bonus != null)
            {
                if (objMod.Bonus["selecttext"] != null)
                {
                    frmSelectText frmPickText = new frmSelectText();
                    frmPickText.Description = LanguageManager.Instance.GetString("String_Improvement_SelectText").Replace("{0}", objMod.DisplayNameShort);
                    frmPickText.ShowDialog(this);
                    objMod.Extra = frmPickText.SelectedValue;
                    objNode.Text = objMod.DisplayName;
                }
                if (objMod.Bonus["improvesensor"] != null)
                {
                    ChangeVehicleSensor(objSelectedVehicle, true);
                }
            }

            _blnIsDirty = true;
            UpdateWindowTitle();

            if (frmPickVehicleMod.AddAgain)
                tsVehicleAddMod_Click(sender, e);
        }
开发者ID:cormanater,项目名称:chummer5a,代码行数:88,代码来源:frmCreate.cs

示例3: AddPACKSKit

        /// <summary>
        /// Add a PACKS Kit to the character.
        /// </summary>
        public void AddPACKSKit()
        {
            frmSelectPACKSKit frmPickPACKSKit = new frmSelectPACKSKit(_objCharacter);
            frmPickPACKSKit.ShowDialog(this);

            bool blnCreateChildren = true;

            // If the form was canceled, don't do anything.
            if (frmPickPACKSKit.DialogResult == DialogResult.Cancel)
                return;

            XmlDocument objXmlDocument = XmlManager.Instance.Load("packs.xml");

            // Do not create child items for Gear if the chosen Kit is in the Custom category since these items will contain the exact plugins desired.
            if (frmPickPACKSKit.SelectedCategory == "Custom")
                blnCreateChildren = false;

            XmlNode objXmlKit = objXmlDocument.SelectSingleNode("/chummer/packs/pack[name = \"" + frmPickPACKSKit.SelectedKit + "\" and category = \"" + frmPickPACKSKit.SelectedCategory + "\"]");
            // Update Qualities.
            if (objXmlKit["qualities"] != null)
            {
                XmlDocument objXmlQualityDocument = XmlManager.Instance.Load("qualities.xml");

                // Positive Qualities.
                foreach (XmlNode objXmlQuality in objXmlKit.SelectNodes("qualities/positive/quality"))
                {
                    XmlNode objXmlQualityNode = objXmlQualityDocument.SelectSingleNode("/chummer/qualities/quality[name = \"" + objXmlQuality.InnerText + "\"]");

                    TreeNode objNode = new TreeNode();
                    List<Weapon> objWeapons = new List<Weapon>();
                    List<TreeNode> objWeaponNodes = new List<TreeNode>();
                    Quality objQuality = new Quality(_objCharacter);
                    string strForceValue = "";

                    if (objXmlQuality.Attributes["select"] != null)
                        strForceValue = objXmlQuality.Attributes["select"].InnerText;

                    objQuality.Create(objXmlQualityNode, _objCharacter, QualitySource.Selected, objNode, objWeapons, objWeaponNodes, strForceValue);
                    _objCharacter.Qualities.Add(objQuality);

                    treQualities.Nodes[0].Nodes.Add(objNode);
                    treQualities.Nodes[0].Expand();

                    // Add any created Weapons to the character.
                    foreach (Weapon objWeapon in objWeapons)
                        _objCharacter.Weapons.Add(objWeapon);

                    // Create the Weapon Node if one exists.
                    foreach (TreeNode objWeaponNode in objWeaponNodes)
                    {
                        objWeaponNode.ContextMenuStrip = cmsWeapon;
                        treWeapons.Nodes[0].Nodes.Add(objWeaponNode);
                        treWeapons.Nodes[0].Expand();
                    }
                }

                // Negative Qualities.
                foreach (XmlNode objXmlQuality in objXmlKit.SelectNodes("qualities/negative/quality"))
                {
                    XmlNode objXmlQualityNode = objXmlQualityDocument.SelectSingleNode("/chummer/qualities/quality[name = \"" + objXmlQuality.InnerText + "\"]");

                    TreeNode objNode = new TreeNode();
                    List<Weapon> objWeapons = new List<Weapon>();
                    List<TreeNode> objWeaponNodes = new List<TreeNode>();
                    Quality objQuality = new Quality(_objCharacter);
                    string strForceValue = "";

                    if (objXmlQuality.Attributes["select"] != null)
                        strForceValue = objXmlQuality.Attributes["select"].InnerText;

                    objQuality.Create(objXmlQualityNode, _objCharacter, QualitySource.Selected, objNode, objWeapons, objWeaponNodes, strForceValue);
                    _objCharacter.Qualities.Add(objQuality);

                    treQualities.Nodes[1].Nodes.Add(objNode);
                    treQualities.Nodes[1].Expand();

                    // Add any created Weapons to the character.
                    foreach (Weapon objWeapon in objWeapons)
                        _objCharacter.Weapons.Add(objWeapon);

                    // Create the Weapon Node if one exists.
                    foreach (TreeNode objWeaponNode in objWeaponNodes)
                    {
                        objWeaponNode.ContextMenuStrip = cmsWeapon;
                        treWeapons.Nodes[0].Nodes.Add(objWeaponNode);
                        treWeapons.Nodes[0].Expand();
                    }
                }
            }

            // Update Attributes.
            if (objXmlKit["attributes"] != null)
            {
                // Reset all Attributes back to 1 so we don't go over any BP limits.
                nudBOD.Value = nudBOD.Minimum;
                nudAGI.Value = nudAGI.Minimum;
                nudREA.Value = nudREA.Minimum;
//.........这里部分代码省略.........
开发者ID:cormanater,项目名称:chummer5a,代码行数:101,代码来源:frmCreate.cs

示例4: tsVehicleAddMod_Click

        private void tsVehicleAddMod_Click(object sender, EventArgs e)
        {
            // Make sure a parent items is selected, then open the Select Vehicle Mod window.
            try
            {
                if (treVehicles.SelectedNode.Level == 0)
                {
                    MessageBox.Show(LanguageManager.Instance.GetString("Message_SelectVehicle"), LanguageManager.Instance.GetString("MessageTitle_SelectVehicle"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }
            catch
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_SelectVehicle"), LanguageManager.Instance.GetString("MessageTitle_SelectVehicle"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (treVehicles.SelectedNode.Level > 1)
                treVehicles.SelectedNode = treVehicles.SelectedNode.Parent;

            Vehicle objSelectedVehicle = _objFunctions.FindVehicle(treVehicles.SelectedNode.Tag.ToString(), _objCharacter.Vehicles);

            frmSelectVehicleMod frmPickVehicleMod = new frmSelectVehicleMod(_objCharacter, true);
            // Set the Vehicle properties for the window.
            frmPickVehicleMod.VehicleCost = Convert.ToInt32(objSelectedVehicle.Cost);
            frmPickVehicleMod.Body = objSelectedVehicle.Body;
            frmPickVehicleMod.Speed = objSelectedVehicle.Speed;
            frmPickVehicleMod.Accel = objSelectedVehicle.Accel;
            frmPickVehicleMod.DeviceRating = objSelectedVehicle.DeviceRating;
            frmPickVehicleMod.HasModularElectronics = objSelectedVehicle.HasModularElectronics();

            frmPickVehicleMod.ShowDialog(this);

            // Make sure the dialogue window was not canceled.
            if (frmPickVehicleMod.DialogResult == DialogResult.Cancel)
                return;

            // Open the Vehicles XML file and locate the selected piece.
            XmlDocument objXmlDocument = XmlManager.Instance.Load("vehicles.xml");

            XmlNode objXmlMod = objXmlDocument.SelectSingleNode("/chummer/mods/mod[name = \"" + frmPickVehicleMod.SelectedMod + "\"]");

            TreeNode objNode = new TreeNode();
            VehicleMod objMod = new VehicleMod(_objCharacter);
            objMod.Create(objXmlMod, objNode, frmPickVehicleMod.SelectedRating);

            // Make sure that the Armor Rating does not exceed the maximum allowed by the Vehicle.
            if (objMod.Name.StartsWith("Armor"))
            {
                if (objMod.Rating > objSelectedVehicle.MaxArmor)
                {
                    objMod.Rating = objSelectedVehicle.MaxArmor;
                    objNode.Text = objMod.DisplayName;
                }
            }

            // Check the item's Cost and make sure the character can afford it.
            int intOriginalCost = objSelectedVehicle.TotalCost;
            objSelectedVehicle.Mods.Add(objMod);

            // Do not allow the user to add a new Vehicle Mod if the Vehicle's Capacity has been reached.
            if (_objOptions.EnforceCapacity && objSelectedVehicle.Slots < objSelectedVehicle.SlotsUsed)
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_CapacityReached"), LanguageManager.Instance.GetString("MessageTitle_CapacityReached"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                objSelectedVehicle.Mods.Remove(objMod);
                if (frmPickVehicleMod.AddAgain)
                    tsVehicleAddMod_Click(sender, e);
                return;
            }

            int intCost = objSelectedVehicle.TotalCost - intOriginalCost;
            // Apply a markup if applicable.
            if (frmPickVehicleMod.Markup != 0)
            {
                double dblCost = Convert.ToDouble(intCost, GlobalOptions.Instance.CultureInfo);
                dblCost *= 1 + (Convert.ToDouble(frmPickVehicleMod.Markup, GlobalOptions.Instance.CultureInfo) / 100.0);
                intCost = Convert.ToInt32(dblCost);
            }

            // Multiply the cost if applicable.
            if (objMod.TotalAvail.EndsWith(LanguageManager.Instance.GetString("String_AvailRestricted")) && _objOptions.MultiplyRestrictedCost)
                intCost *= _objOptions.RestrictedCostMultiplier;
            if (objMod.TotalAvail.EndsWith(LanguageManager.Instance.GetString("String_AvailForbidden")) && _objOptions.MultiplyForbiddenCost)
                intCost *= _objOptions.ForbiddenCostMultiplier;

            if (!frmPickVehicleMod.FreeCost)
            {
                if (intCost > _objCharacter.Nuyen)
                {
                    objSelectedVehicle.Mods.Remove(objMod);
                    MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughNuyen"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughNuyen"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    if (frmPickVehicleMod.AddAgain)
                        tsVehicleAddMod_Click(sender, e);

                    return;
                }
                else
                {
                    // Create the Expense Log Entry.
                    ExpenseLogEntry objExpense = new ExpenseLogEntry();
//.........这里部分代码省略.........
开发者ID:Althalusdlg,项目名称:chummer5a,代码行数:101,代码来源:frmCareer.cs

示例5: TestVehicles

        private void TestVehicles()
        {
            Character objCharacter = new Character();
            XmlDocument objXmlDocument = XmlManager.Instance.Load("vehicles.xml");
            pgbProgress.Minimum = 0;
            pgbProgress.Value = 0;
            pgbProgress.Maximum = objXmlDocument.SelectNodes("/chummer/vehicles/vehicle").Count;
            pgbProgress.Maximum += objXmlDocument.SelectNodes("/chummer/mods/mod").Count;

            // Vehicles.
            foreach (XmlNode objXmlGear in objXmlDocument.SelectNodes("/chummer/vehicles/vehicle"))
            {
                pgbProgress.Value++;
                Application.DoEvents();
                try
                {
                    TreeNode objTempNode = new TreeNode();
                    Vehicle objTemp = new Vehicle(objCharacter);
                    objTemp.Create(objXmlGear, objTempNode, null, null, null, null, null);
                    try
                    {
                        int objValue = objTemp.TotalCost;
                    }
                    catch
                    {
                        txtOutput.Text += objXmlGear["name"].InnerText + " failed TotalCost\n";
                    }
                    try
                    {
                        string objValue = objTemp.TotalAccel;
                    }
                    catch
                    {
                        txtOutput.Text += objXmlGear["name"].InnerText + " failed TotalAccel\n";
                    }
                    try
                    {
                        int objValue = objTemp.TotalArmor;
                    }
                    catch
                    {
                        txtOutput.Text += objXmlGear["name"].InnerText + " failed TotalArmor\n";
                    }
                    try
                    {
                        int objValue = objTemp.TotalBody;
                    }
                    catch
                    {
                        txtOutput.Text += objXmlGear["name"].InnerText + " failed TotalBody\n";
                    }
                    try
                    {
                        int objValue = objTemp.TotalHandling;
                    }
                    catch
                    {
                        txtOutput.Text += objXmlGear["name"].InnerText + " failed TotalHandling\n";
                    }
                    try
                    {
                        int objValue = objTemp.TotalSpeed;
                    }
                    catch
                    {
                        txtOutput.Text += objXmlGear["name"].InnerText + " failed TotalSpeed\n";
                    }
                    try
                    {
                        string objValue = objTemp.CalculatedAvail;
                    }
                    catch
                    {
                        txtOutput.Text += objXmlGear["name"].InnerText + " failed CalculatedAvail\n";
                    }
                }
                catch
                {
                    txtOutput.Text += objXmlGear["name"].InnerText + " general failure\n";
                }
            }

            // Vehicle Mods.
            foreach (XmlNode objXmlGear in objXmlDocument.SelectNodes("/chummer/mods/mod"))
            {
                pgbProgress.Value++;
                Application.DoEvents();
                try
                {
                    TreeNode objTempNode = new TreeNode();
                    VehicleMod objTemp = new VehicleMod(objCharacter);
                    objTemp.Create(objXmlGear, objTempNode, 1);
                    try
                    {
                        int objValue = objTemp.TotalCost;
                    }
                    catch
                    {
                        txtOutput.Text += objXmlGear["name"].InnerText + " failed TotalCost\n";
                    }
//.........这里部分代码省略.........
开发者ID:hollis21,项目名称:Chummer,代码行数:101,代码来源:frmTest.cs

示例6: UpdateGearInfo

        /// <summary>
        /// Update the Mod's information based on the Mod selected and current Rating.
        /// </summary>
        private void UpdateGearInfo()
        {
            if (lstMod.Text != "")
            {
                // Retireve the information for the selected Mod.
                XmlNode objXmlMod = _objXmlDocument.SelectSingleNode("/chummer/mods/mod[id = \"" + lstMod.SelectedValue + "\"]");

                string strAvail = "";
                string strModBook = "";
                string strModPage = "";
                int intItemCost = 0;
                int intSlots = 0;

                if (_objMode == Mode.Vehicle)
                {
                    TreeNode objTreeNode = new TreeNode();
                    VehicleMod objVehicleMod = new VehicleMod(_objCharacter);
                    objVehicleMod.Create(objXmlMod, objTreeNode, Convert.ToInt32(nudRating.Value));

                    Vehicle objVehicle = new Vehicle(_objCharacter);
                    objVehicleMod.Parent = objVehicle;
                    if (_intVehicleCost != 0)
                        objVehicle.Cost = _intVehicleCost.ToString();
                    string strAccel = _intAccelWalking.ToString() + "/" + _intAccelRunning.ToString();
                    objVehicle.Accel = strAccel;
                    if (_intBody != 0)
                        objVehicle.Body = _intBody;
                    if (_intSpeed != 0)
                        objVehicle.Speed = _intSpeed;

                    strAvail = objVehicleMod.TotalAvail;
                    intItemCost = objVehicleMod.TotalCost;
                    intSlots = objVehicleMod.CalculatedSlots;
                    strModBook = objVehicleMod.Source;
                    strModPage = objVehicleMod.Page;
                }
                else if (_objMode == Mode.WeaponMod)
                {
                    TreeNode objTreeNode = new TreeNode();
                    WeaponMod objWeaponMod = new WeaponMod(_objCharacter);
                    objWeaponMod.Create(objXmlMod, objTreeNode);

                    if (_intWeaponCost != 0)
                    {
                        Weapon objWeapon = new Weapon(_objCharacter);
                        objWeapon.Cost = _intWeaponCost;
                        objWeaponMod.Parent = objWeapon;
                    }

                    strAvail = objWeaponMod.TotalAvail;
                    intItemCost = objWeaponMod.TotalCost;
                    intSlots = objWeaponMod.Slots;
                    strModBook = objWeaponMod.Source;
                    strModPage = objWeaponMod.Page;
                }

                lblAvail.Text = strAvail;

                // Cost.
                if (objXmlMod["cost"].InnerText.StartsWith("Variable"))
                {
                    int intMin = 0;
                    int intMax = 0;
                    string strCost = objXmlMod["cost"].InnerText.Replace("Variable(", string.Empty).Replace(")", string.Empty);
                    if (strCost.Contains("-"))
                    {
                        string[] strValues = strCost.Split('-');
                        intMin = Convert.ToInt32(strValues[0]);
                        intMax = Convert.ToInt32(strValues[1]);
                    }
                    else
                        intMin = Convert.ToInt32(strCost.Replace("+", string.Empty));

                    if (intMax == 0)
                    {
                        intMax = 1000000;
                        lblCost.Text = String.Format("{0:###,###,##0¥+}", intMin);
                    }
                    else
                        lblCost.Text = String.Format("{0:###,###,##0}", intMin) + "-" + String.Format("{0:###,###,##0¥}", intMax);

                    intItemCost = intMin;
                }
                else
                {
                    int intCost = Convert.ToInt32(Convert.ToDouble(intItemCost, GlobalOptions.Instance.CultureInfo));
                    intCost *= _intModMultiplier;

                    // Apply any markup.
                    double dblCost = Convert.ToDouble(intCost, GlobalOptions.Instance.CultureInfo);
                    dblCost *= 1 + (Convert.ToDouble(nudMarkup.Value, GlobalOptions.Instance.CultureInfo) / 100.0);
                    intCost = Convert.ToInt32(dblCost);

                    lblCost.Text = String.Format("{0:###,###,##0¥}", intCost);

                    intItemCost = intCost;
                }
//.........这里部分代码省略.........
开发者ID:janhelke,项目名称:chummer2,代码行数:101,代码来源:frmSelectVehicleMod.cs

示例7: CreateAllVehicleModsTest

        public void CreateAllVehicleModsTest()
        {
            // Create a new Human character.
            Character objCharacter = new Character();
            objCharacter.LoadMetatype(Guid.Parse("e28e7075-f635-4c02-937c-e4fc61c51602"));

            TreeNode objNode = new TreeNode();

            XmlDocument objXmlDocument = XmlManager.Instance.Load("vehicles.xml");
            foreach (XmlNode objXmlNode in objXmlDocument.SelectNodes("/chummer/mods/mod"))
            {
                VehicleMod objMod = new VehicleMod(objCharacter);
                objMod.Create(objXmlNode, objNode, 1);
            }
        }
开发者ID:janhelke,项目名称:chummer2,代码行数:15,代码来源:EquipmentTests.cs


注:本文中的VehicleMod.Create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。