• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Chummer.frmSelectVehicleMod类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Chummer.frmSelectVehicleMod的典型用法代码示例。如果您正苦于以下问题:C# frmSelectVehicleMod类的具体用法?C# frmSelectVehicleMod怎么用?C# frmSelectVehicleMod使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



frmSelectVehicleMod类属于Chummer命名空间,在下文中一共展示了frmSelectVehicleMod类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: tsVehicleAddWeaponModification_Click

        private void tsVehicleAddWeaponModification_Click(object sender, EventArgs e)
        {
            // Attempt to locate the selected VehicleWeapon.
            bool blnFound = false;
            Vehicle objFoundVehicle = new Vehicle(_objCharacter);
            Weapon objWeapon = _objFunctions.FindVehicleWeapon(treVehicles.SelectedNode.Tag.ToString(), _objCharacter.Vehicles, out objFoundVehicle);
            if (objWeapon != null)
                blnFound = true;

            if (!blnFound)
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_VehicleWeaponMods"), LanguageManager.Instance.GetString("MessageTitle_VehicleWeaponMods"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            frmSelectVehicleMod frmPickVehicleMod = new frmSelectVehicleMod(_objCharacter);

            // Make sure the Weapon allows Modifications to be added to it.
            // Open the Weapons XML file and locate the selected Weapon.
            XmlDocument objXmlDocument = XmlManager.Instance.Load("weapons.xml");
            XmlNode objXmlWeapon = objXmlDocument.SelectSingleNode("/chummer/weapons/weapon[name = \"" + objWeapon.Name + "\"]");

            if (objXmlWeapon == null)
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_CannotModifyWeaponMod"), LanguageManager.Instance.GetString("MessageTitle_CannotModifyWeapon"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (objXmlWeapon["allowmod"] != null)
            {
                if (objXmlWeapon["allowmod"].InnerText == "false")
                {
                    MessageBox.Show(LanguageManager.Instance.GetString("Message_CannotModifyWeaponMod"), LanguageManager.Instance.GetString("MessageTitle_CannotModifyWeapon"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }

            // Set the Weapon properties for the window.
            frmPickVehicleMod.WeaponCost = objWeapon.Cost;
            frmPickVehicleMod.TotalWeaponCost = objWeapon.TotalCost;
            frmPickVehicleMod.ModMultiplier = objWeapon.ModMultiplier;
            frmPickVehicleMod.InputFile = "weapons";

            frmPickVehicleMod.ShowDialog(this);

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

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

            TreeNode objNode = new TreeNode();
            WeaponMod objMod = new WeaponMod(_objCharacter);
            objMod.Create(objXmlMod, objNode);
            objMod.Rating = frmPickVehicleMod.SelectedRating;
            objMod.Parent = objWeapon;

            objWeapon.WeaponMods.Add(objMod);
            objNode.Text = objMod.DisplayName;
            objNode.ContextMenuStrip = cmsVehicleWeaponMod;

            treVehicles.SelectedNode.Nodes.Add(objNode);
            treVehicles.SelectedNode.Expand();

            if (frmPickVehicleMod.AddAgain)
                tsVehicleAddWeaponModification_Click(sender, e);

            UpdateCharacterInfo();
        }
开发者ID:cormanater,项目名称:chummer5a,代码行数:70,代码来源: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: tsWeaponAddModification_Click

        private void tsWeaponAddModification_Click(object sender, EventArgs e)
        {
            // Make sure a parent item is selected, then open the Select Accessory window.
            try
            {
                if (treWeapons.SelectedNode.Level == 0)
                {
                    MessageBox.Show(LanguageManager.Instance.GetString("Message_SelectWeaponMod"), LanguageManager.Instance.GetString("MessageTitle_SelectWeapon"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }
            catch
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_SelectWeaponMod"), LanguageManager.Instance.GetString("MessageTitle_SelectWeapon"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            // Locate the Weapon that is selected in the Tree.
            Weapon objWeapon = _objFunctions.FindWeapon(treWeapons.SelectedNode.Tag.ToString(), _objCharacter.Weapons);

            frmSelectVehicleMod frmPickVehicleMod = new frmSelectVehicleMod(_objCharacter, true);

            // Make sure the Weapon allows Modifications to be added to it.
            // Open the Weapons XML file and locate the selected Weapon.
            XmlDocument objXmlDocument = XmlManager.Instance.Load("weapons.xml");
            XmlNode objXmlWeapon = objXmlDocument.SelectSingleNode("/chummer/weapons/weapon[name = \"" + objWeapon.Name + "\"]");

            if (objXmlWeapon == null)
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_CannotModifyWeaponMod"), LanguageManager.Instance.GetString("MessageTitle_CannotModifyWeapon"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (objXmlWeapon["allowmod"] != null)
            {
                if (objXmlWeapon["allowmod"].InnerText == "false")
                {
                    MessageBox.Show(LanguageManager.Instance.GetString("Message_CannotModifyWeaponMod"), LanguageManager.Instance.GetString("MessageTitle_CannotModifyWeapon"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }

            // Set the Weapon properties for the window.
            frmPickVehicleMod.WeaponCost = objWeapon.Cost;
            frmPickVehicleMod.TotalWeaponCost = objWeapon.TotalCost;
            frmPickVehicleMod.ModMultiplier = objWeapon.ModMultiplier;
            frmPickVehicleMod.InputFile = "weapons";

            frmPickVehicleMod.ShowDialog(this);

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

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

            TreeNode objNode = new TreeNode();
            WeaponMod objMod = new WeaponMod(_objCharacter);
            objMod.Create(objXmlMod, objNode);
            objMod.Rating = frmPickVehicleMod.SelectedRating;
            objMod.Parent = objWeapon;

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

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

            int intCost = objWeapon.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)
                {
                    objWeapon.WeaponMods.Remove(objMod);
                    MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughNuyen"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughNuyen"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    if (frmPickVehicleMod.AddAgain)
                        tsWeaponAddModification_Click(sender, e);

//.........这里部分代码省略.........
开发者ID:Althalusdlg,项目名称:chummer5a,代码行数:101,代码来源:frmCareer.cs


示例4: tsWeaponAddModification_Click

        private void tsWeaponAddModification_Click(object sender, EventArgs e)
        {
            // Make sure a parent item is selected, then open the Select Accessory window.
            try
            {
                if (treWeapons.SelectedNode.Level == 0)
                {
                    MessageBox.Show(LanguageManager.Instance.GetString("Message_SelectWeaponMod"), LanguageManager.Instance.GetString("MessageTitle_SelectWeapon"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }
            catch
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_SelectWeaponMod"), LanguageManager.Instance.GetString("MessageTitle_SelectWeapon"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            // Locate the Weapon that is selected in the Tree.
            Weapon objWeapon = (Weapon)_objFunctions.FindEquipment(treWeapons.SelectedNode.Tag.ToString(), _objCharacter.Weapons, typeof(Weapon));

            frmSelectVehicleMod frmPickVehicleMod = new frmSelectVehicleMod(_objCharacter);

            // Make sure the Weapon allows Modifications to be added to it.
            // Open the Weapons XML file and locate the selected Weapon.
            XmlDocument objXmlDocument = XmlManager.Instance.Load("weapons.xml");
            XmlNode objXmlWeapon = objXmlDocument.SelectSingleNode("/chummer/weapons/weapon[id = \"" + objWeapon.ExternalId + "\"]");

            if (objXmlWeapon == null)
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_CannotModifyWeaponMod"), LanguageManager.Instance.GetString("MessageTitle_CannotModifyWeapon"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (objXmlWeapon["allowmod"] != null)
            {
                if (objXmlWeapon["allowmod"].InnerText == "false")
                {
                    MessageBox.Show(LanguageManager.Instance.GetString("Message_CannotModifyWeaponMod"), LanguageManager.Instance.GetString("MessageTitle_CannotModifyWeapon"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }

            // Set the Weapon properties for the window.
            frmPickVehicleMod.WeaponCost = objWeapon.Cost;
            frmPickVehicleMod.TotalWeaponCost = objWeapon.TotalCost;
            frmPickVehicleMod.ModMultiplier = objWeapon.ModMultiplier;
            frmPickVehicleMod.WindowMode = frmSelectVehicleMod.Mode.WeaponMod;

            frmPickVehicleMod.ShowDialog(this);

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

            // Locate the selected piece.
            XmlNode objXmlMod = objXmlDocument.SelectSingleNode("/chummer/mods/mod[id = \"" + frmPickVehicleMod.SelectedMod + "\"]");

            TreeNode objNode = new TreeNode();
            WeaponMod objMod = new WeaponMod(_objCharacter);
            objMod.Create(objXmlMod, objNode);
            objMod.Rating = frmPickVehicleMod.SelectedRating;
            objMod.Parent = objWeapon;

            objWeapon.WeaponMods.Add(objMod);

            objNode.Text = objMod.DisplayName;
            objNode.ContextMenuStrip = cmsWeaponMod;

            treWeapons.SelectedNode.Nodes.Add(objNode);
            treWeapons.SelectedNode.Expand();

            UpdateCharacterInfo();
            RefreshSelectedWeapon();

            if (frmPickVehicleMod.AddAgain)
                tsWeaponAddModification_Click(sender, e);
        }
开发者ID:janhelke,项目名称:chummer2,代码行数:77,代码来源:frmCreate.cs


示例5: 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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Chummer.frmSelectWeapon类代码示例发布时间:2022-05-24
下一篇:
C# Chummer.frmSelectText类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap