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

C# Cyberware类代码示例

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

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



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

示例1: BuildCyberwareTree

        /// <summary>
        /// Build up the Tree for the current piece of Cyberware and all of its children.
        /// </summary>
        /// <param name="objCyberware">Cyberware to iterate through.</param>
        /// <param name="objParentNode">TreeNode to append to.</param>
        /// <param name="objMenu">ContextMenuStrip that the new Cyberware TreeNodes should use.</param>
        /// <param name="objGearMenu">ContextMenuStrip that the new Gear TreeNodes should use.</param>
        public void BuildCyberwareTree(Cyberware objCyberware, TreeNode objParentNode, ContextMenuStrip objMenu, ContextMenuStrip objGearMenu)
        {
            TreeNode objNode = new TreeNode();
                objNode.Text = objCyberware.DisplayName;
                objNode.Tag = objCyberware.InternalId;
                if (objCyberware.Notes != string.Empty)
                    objNode.ForeColor = Color.SaddleBrown;
                objNode.ToolTipText = objCyberware.Notes;
                objNode.ContextMenuStrip = objMenu;

                objParentNode.Nodes.Add(objNode);
                objParentNode.Expand();

                foreach (Cyberware objChild in objCyberware.Children)
                    BuildCyberwareTree(objChild, objNode, objMenu, objGearMenu);

                foreach (Gear objGear in objCyberware.Gear)
                {
                    TreeNode objGearNode = new TreeNode();
                    objGearNode.Text = objGear.DisplayName;
                    objGearNode.Tag = objGear.InternalId;
                    if (objGear.Notes != string.Empty)
                        objGearNode.ForeColor = Color.SaddleBrown;
                    objGearNode.ToolTipText = objGear.Notes;
                    objGearNode.ContextMenuStrip = objGearMenu;

                    BuildGearTree(objGear, objGearNode, objGearMenu);

                    objNode.Nodes.Add(objGearNode);
                    objNode.Expand();
                }
        }
开发者ID:hollis21,项目名称:Chummer,代码行数:39,代码来源:clsCommon.cs


示例2: CreateAllBiowareTest

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

            TreeNode objNode = new TreeNode();
            List<Weapon> lstWeapons = new List<Weapon>();
            List<TreeNode> lstTreeNodes = new List<TreeNode>();

            GradeList objGradeList = new GradeList();
            objGradeList.LoadList(Improvement.ImprovementSource.Bioware);

            XmlDocument objXmlDocument = XmlManager.Instance.Load("bioware.xml");
            foreach (XmlNode objXmlNode in objXmlDocument.SelectNodes("/chummer/biowares/bioware"))
            {
                Cyberware objCyberware = new Cyberware(objCharacter);
                objCyberware.Create(objXmlNode, objCharacter, objGradeList.GetGrade("Standard"), Improvement.ImprovementSource.Bioware, 1, objNode, lstWeapons, lstTreeNodes);
            }
        }
开发者ID:janhelke,项目名称:chummer2,代码行数:20,代码来源:EquipmentTests.cs


示例3: EssenceCyberwareAndBiowareTest

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

            Cyberware objCybeware = new Cyberware(objCharacter);
            objCybeware.SourceType = Improvement.ImprovementSource.Cyberware;
            objCybeware.ESS = "0.6";

            Cyberware objBioware = new Cyberware(objCharacter);
            objBioware.SourceType = Improvement.ImprovementSource.Bioware;
            objBioware.ESS = "0.4";

            objCharacter.Cyberware.Add(objCybeware);
            objCharacter.Cyberware.Add(objBioware);

            // Bioware Essence should only be 0.2 since the lower of the Cyberware/Bioware totals is halved.
            Assert.AreEqual(5.2m, objCharacter.Essence, "Essence does not equal the expected value of 5.6.");
            Assert.AreEqual(0.6m, objCharacter.CyberwareEssence, "Cyberware Essence does not equal the expected value of 0.6.");
            Assert.AreEqual(0.2m, objCharacter.BiowareEssence, "Bioware Essence does not equal the expected value of 0.2.");
        }
开发者ID:janhelke,项目名称:chummer2,代码行数:22,代码来源:CharacterTests.cs


示例4: tsCyberwareGearMenuAddAsPlugin_Click

        private void tsCyberwareGearMenuAddAsPlugin_Click(object sender, EventArgs e)
        {
            // Make sure a parent items is selected, then open the Select Gear window.
            try
            {
                if (treCyberware.SelectedNode.Level < 2)
                {
                    MessageBox.Show(LanguageManager.Instance.GetString("Message_ModifyVehicleGear"), LanguageManager.Instance.GetString("MessageTitle_SelectGear"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }
            catch
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_ModifyVehicleGear"), LanguageManager.Instance.GetString("MessageTitle_SelectGear"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (treCyberware.SelectedNode.Level > 3)
                treCyberware.SelectedNode = treCyberware.SelectedNode.Parent;

            // Locate the Vehicle Sensor Gear.
            bool blnFound = false;
            Cyberware objFoundCyber = new Cyberware(_objCharacter);
            Gear objSensor = _objFunctions.FindCyberwareGear(treCyberware.SelectedNode.Tag.ToString(), _objCharacter.Cyberware, out objFoundCyber);
            if (objSensor != null)
                blnFound = true;

            // Make sure the Gear was found.
            if (!blnFound)
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_ModifyVehicleGear"), LanguageManager.Instance.GetString("MessageTitle_SelectGear"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

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

            XmlNode objXmlGear = objXmlDocument.SelectSingleNode("/chummer/gears/gear[name = \"" + objSensor.Name + "\" and category = \"" + objSensor.Category + "\"]");

            frmSelectGear frmPickGear = new frmSelectGear(_objCharacter, true);
            //frmPickGear.ShowNegativeCapacityOnly = true;

            if (objXmlGear.InnerXml.Contains("<addoncategory>"))
            {
                string strCategories = "";
                foreach (XmlNode objXmlCategory in objXmlGear.SelectNodes("addoncategory"))
                    strCategories += objXmlCategory.InnerText + ",";
                // Remove the trailing comma.
                strCategories = strCategories.Substring(0, strCategories.Length - 1);
                frmPickGear.AddCategory(strCategories);
            }

            if (frmPickGear.AllowedCategories != "")
                frmPickGear.AllowedCategories += objSensor.Category + ",";

            frmPickGear.ShowDialog(this);

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

            // Open the Gear XML file and locate the selected piece.
            objXmlGear = objXmlDocument.SelectSingleNode("/chummer/gears/gear[name = \"" + frmPickGear.SelectedGear + "\" and category = \"" + frmPickGear.SelectedCategory + "\"]");

            // Create the new piece of Gear.
            List<Weapon> objWeapons = new List<Weapon>();
            List<TreeNode> objWeaponNodes = new List<TreeNode>();
            TreeNode objNode = new TreeNode();
            Gear objGear = new Gear(_objCharacter);

            switch (frmPickGear.SelectedCategory)
            {
                case "Commlink":
                case "Commlink Upgrade":
                    Commlink objCommlink = new Commlink(_objCharacter);
                    objCommlink.Create(objXmlGear, _objCharacter, objNode, frmPickGear.SelectedRating);
                    objCommlink.Quantity = frmPickGear.SelectedQty;
                    objNode.Text = objCommlink.DisplayName;

                    objGear = objCommlink;
                    break;
                case "Commlink Operating System":
                case "Commlink Operating System Upgrade":
                    OperatingSystem objOperatingSystem = new OperatingSystem(_objCharacter);
                    objOperatingSystem.Create(objXmlGear, _objCharacter, objNode, frmPickGear.SelectedRating);
                    objOperatingSystem.Quantity = frmPickGear.SelectedQty;
                    objNode.Text = objOperatingSystem.DisplayName;

                    objGear = objOperatingSystem;
                    break;
                default:
                    Gear objNewGear = new Gear(_objCharacter);
                    objNewGear.Create(objXmlGear, _objCharacter, objNode, frmPickGear.SelectedRating, objWeapons, objWeaponNodes, "", frmPickGear.Hacked, frmPickGear.InherentProgram, true, true, frmPickGear.Aerodynamic);
                    objNewGear.Quantity = frmPickGear.SelectedQty;
                    objNode.Text = objNewGear.DisplayName;

                    objGear = objNewGear;
                    break;
            }

            if (objGear.InternalId == Guid.Empty.ToString())
                return;
//.........这里部分代码省略.........
开发者ID:Nebual,项目名称:chummer,代码行数:101,代码来源:frmCareer.cs


示例5: ProcessBonus


//.........这里部分代码省略.........
                Log.Info("transgenicsgenetechcost = " + bonusNode.OuterXml.ToString());
                Log.Info("Calling CreateImprovement");
                CreateImprovement("", objImprovementSource, strSourceName, Improvement.ImprovementType.TransgenicsBiowareCost,
                    strUnique, ValueToInt(bonusNode.InnerText, intRating));
            }

            // Check for Basic Bioware Essence Cost modifiers.
            if (bonusNode.LocalName == ("basicbiowareessmultiplier"))
            {
                Log.Info("basicbiowareessmultiplier");
                Log.Info("basicbiowareessmultiplier = " + bonusNode.OuterXml.ToString());
                Log.Info("Calling CreateImprovement");
                CreateImprovement("", objImprovementSource, strSourceName, Improvement.ImprovementType.BasicBiowareEssCost,
                    strUnique,
                    ValueToInt(bonusNode.InnerText, intRating));
            }

            // Check for Bioware Essence Cost modifiers.
            if (bonusNode.LocalName == ("biowareessmultiplier"))
            {
                Log.Info("biowareessmultiplier");
                Log.Info("biowareessmultiplier = " + bonusNode.OuterXml.ToString());
                Log.Info("Calling CreateImprovement");
                CreateImprovement("", objImprovementSource, strSourceName, Improvement.ImprovementType.BiowareEssCost, strUnique,
                    ValueToInt(bonusNode.InnerText, intRating));
            }

            // Check for Cybeware Essence Cost modifiers.
            if (bonusNode.LocalName == ("cyberwareessmultiplier"))
            {
                Log.Info("cyberwareessmultiplier");
                Log.Info("cyberwareessmultiplier = " + bonusNode.OuterXml.ToString());
                Log.Info("Calling CreateImprovement");
                CreateImprovement("", objImprovementSource, strSourceName, Improvement.ImprovementType.CyberwareEssCost, strUnique,
                    ValueToInt(bonusNode.InnerText, intRating));
            }

            // Check for Uneducated modifiers.
            if (bonusNode.LocalName == ("uneducated"))
            {
                Log.Info("uneducated");
                Log.Info("uneducated = " + bonusNode.OuterXml.ToString());
                Log.Info("Calling CreateImprovement");
                CreateImprovement("", objImprovementSource, strSourceName, Improvement.ImprovementType.Uneducated, strUnique);
                _objCharacter.SkillsSection.Uneducated = true;
            }

            // Check for College Education modifiers.
            if (bonusNode.LocalName == ("collegeeducation"))
            {
                Log.Info("collegeeducation");
                Log.Info("collegeeducation = " + bonusNode.OuterXml.ToString());
                Log.Info("Calling CreateImprovement");
                CreateImprovement("", objImprovementSource, strSourceName, Improvement.ImprovementType.CollegeEducation, strUnique);
                _objCharacter.SkillsSection.CollegeEducation = true;
            }

            // Check for Jack Of All Trades modifiers.
            if (bonusNode.LocalName == ("jackofalltrades"))
            {
                Log.Info("jackofalltrades");
                Log.Info("jackofalltrades = " + bonusNode.OuterXml.ToString());
                Log.Info("Calling CreateImprovement");
                CreateImprovement("", objImprovementSource, strSourceName, Improvement.ImprovementType.JackOfAllTrades, strUnique);
                _objCharacter.SkillsSection.JackOfAllTrades = true;
            }
开发者ID:Rockzo,项目名称:chummer5a,代码行数:67,代码来源:clsImprovement.cs


示例6: CreateSuiteCyberware

        /// <summary>
        /// Create Cyberware from a Cyberware Suite.
        /// </summary>
        /// <param name="objXmlNode">XmlNode for the Cyberware to add.</param>
        /// <param name="objGrade">CyberwareGrade to add the item as.</param>
        /// <param name="intRating">Rating of the Cyberware.</param>
        /// <param name="blnAddToCharacter">Whether or not the Cyberware should be added directly to the character.</param>
        /// <param name="objParent">Parent Cyberware if the item is not being added directly to the character.</param>
        private TreeNode CreateSuiteCyberware(XmlNode objXmlItem, XmlNode objXmlNode, Grade objGrade, int intRating, bool blnAddToCharacter, Improvement.ImprovementSource objSource, string strType, Cyberware objParent = null)
        {
            // Create the Cyberware object.
            List<Weapon> objWeapons = new List<Weapon>();
            List<TreeNode> objWeaponNodes = new List<TreeNode>();
            TreeNode objNode = new TreeNode();
            Cyberware objCyberware = new Cyberware(_objCharacter);
            string strForced = "";

            if (objXmlItem["name"].Attributes["select"] != null)
                strForced = objXmlItem["name"].Attributes["select"].InnerText;

            objCyberware.Create(objXmlNode, _objCharacter, objGrade, objSource, intRating, objNode, objWeapons, objWeaponNodes, true, true, strForced);
            objCyberware.Suite = true;

            foreach (Weapon objWeapon in objWeapons)
                _objCharacter.Weapons.Add(objWeapon);

            foreach (TreeNode objWeaponNode in objWeaponNodes)
            {
                treWeapons.Nodes[0].Nodes.Add(objWeaponNode);
                treWeapons.Nodes[0].Expand();
            }

            if (blnAddToCharacter)
                _objCharacter.Cyberware.Add(objCyberware);
            else
                objParent.Children.Add(objCyberware);

            foreach (XmlNode objXmlChild in objXmlItem.SelectNodes(strType + "s/" + strType))
            {
                XmlDocument objXmlDocument = XmlManager.Instance.Load(strType + ".xml");
                XmlNode objXmlChildCyberware = objXmlDocument.SelectSingleNode("/chummer/" + strType + "s/" + strType + "[name = \"" + objXmlChild["name"].InnerText + "\"]");
                TreeNode objChildNode = new TreeNode();
                int intChildRating = 0;

                if (objXmlChild["rating"] != null)
                    intChildRating = Convert.ToInt32(objXmlChild["rating"].InnerText);

                objChildNode = CreateSuiteCyberware(objXmlChild, objXmlChildCyberware, objGrade, intChildRating, false, objSource, strType, objCyberware);
                objNode.Nodes.Add(objChildNode);
                objNode.Expand();
            }

            return objNode;
        }
开发者ID:cormanater,项目名称:chummer5a,代码行数:54,代码来源:frmCreate.cs


示例7: AddCyberwareSuite

        private void AddCyberwareSuite(Improvement.ImprovementSource objSource)
        {
            frmSelectCyberwareSuite frmPickCyberwareSuite = new frmSelectCyberwareSuite(objSource, _objCharacter);
            frmPickCyberwareSuite.ShowDialog(this);

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

            string strType = "";
            int intParentNode = 0;
            if (objSource == Improvement.ImprovementSource.Cyberware)
            {
                strType = "cyberware";
                intParentNode = 0;
            }
            else
            {
                strType = "bioware";
                intParentNode = 1;
            }
            XmlDocument objXmlDocument = XmlManager.Instance.Load(strType + ".xml");

            XmlNode objXmlSuite = objXmlDocument.SelectSingleNode("/chummer/suites/suite[name = \"" + frmPickCyberwareSuite.SelectedSuite + "\"]");
            Cyberware objTemp = new Cyberware(_objCharacter);
            Grade objGrade = new Grade();
            objGrade = objTemp.ConvertToCyberwareGrade(objXmlSuite["grade"].InnerText, objSource);

            // Run through each of the items in the Suite and add them to the character.
            foreach (XmlNode objXmlItem in objXmlSuite.SelectNodes(strType + "s/" + strType))
            {
                XmlNode objXmlCyberware = objXmlDocument.SelectSingleNode("/chummer/" + strType + "s/" + strType + "[name = \"" + objXmlItem["name"].InnerText + "\"]");
                TreeNode objNode = new TreeNode();
                int intRating = 0;

                if (objXmlItem["rating"] != null)
                    intRating = Convert.ToInt32(objXmlItem["rating"].InnerText);

                objNode = CreateSuiteCyberware(objXmlItem, objXmlCyberware, objGrade, intRating, true, objSource, strType, null);

                objNode.Expand();
                treCyberware.Nodes[intParentNode].Nodes.Add(objNode);
                treCyberware.Nodes[intParentNode].Expand();
            }

            _blnIsDirty = true;
            UpdateWindowTitle();
            UpdateCharacterInfo();
        }
开发者ID:cormanater,项目名称:chummer5a,代码行数:48,代码来源:frmCreate.cs


示例8: tsVehicleAddCyberware_Click

        private void tsVehicleAddCyberware_Click(object sender, EventArgs e)
        {
            Vehicle objVehicle = new Vehicle(_objCharacter);
            VehicleMod objMod = _objFunctions.FindVehicleMod(treVehicles.SelectedNode.Tag.ToString(), _objCharacter.Vehicles, out objVehicle);

            if (objMod == null)
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_VehicleCyberwarePlugin"), LanguageManager.Instance.GetString("MessageTitle_NoCyberware"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (!objMod.AllowCyberware)
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_VehicleCyberwarePlugin"), LanguageManager.Instance.GetString("MessageTitle_NoCyberware"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            frmSelectCyberware frmPickCyberware = new frmSelectCyberware(_objCharacter);
            frmPickCyberware.SetGrade = "Standard";
            frmPickCyberware.LockGrade();
            frmPickCyberware.ShowOnlySubsystems = true;
            frmPickCyberware.Subsystems = objMod.Subsystems;
            frmPickCyberware.AllowModularPlugins = objMod.AllowModularPlugins;
            frmPickCyberware.ShowDialog(this);

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

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

            XmlNode objXmlCyberware = objXmlDocument.SelectSingleNode("/chummer/cyberwares/cyberware[name = \"" + frmPickCyberware.SelectedCyberware + "\"]");

            // Create the Cyberware object.
            Cyberware objCyberware = new Cyberware(_objCharacter);
            List<Weapon> objWeapons = new List<Weapon>();
            TreeNode objNode = new TreeNode();
            List<TreeNode> objWeaponNodes = new List<TreeNode>();
            objCyberware.Create(objXmlCyberware, _objCharacter, frmPickCyberware.SelectedGrade, Improvement.ImprovementSource.Cyberware, frmPickCyberware.SelectedRating, objNode, objWeapons, objWeaponNodes, false);
            if (objCyberware.InternalId == Guid.Empty.ToString())
                return;

            if (frmPickCyberware.FreeCost)
                objCyberware.Cost = "0";

            treVehicles.SelectedNode.Nodes.Add(objNode);
            treVehicles.SelectedNode.Expand();
            objMod.Cyberware.Add(objCyberware);

            foreach (Weapon objWeapon in objWeapons)
            {
                objWeapon.VehicleMounted = true;
                objVehicle.Weapons.Add(objWeapon);
            }

            // Create the Weapon Node if one exists.
            foreach (TreeNode objWeaponNode in objWeaponNodes)
            {
                objWeaponNode.ContextMenuStrip = cmsVehicleWeapon;
                treVehicles.SelectedNode.Parent.Nodes.Add(objWeaponNode);
                treVehicles.SelectedNode.Parent.Expand();
            }

            UpdateCharacterInfo();

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


示例9: PickCyberware

        /// <summary>
        /// Open the Select Cyberware window and handle adding to the Tree and Character.
        /// </summary>
        private bool PickCyberware(Improvement.ImprovementSource objSource = Improvement.ImprovementSource.Cyberware)
        {
            // Determine the lowest whole number for the character's current Essence.
            decimal decStartingESS = Math.Floor(_objCharacter.Essence);

            Cyberware objSelectedCyberware = new Cyberware(_objCharacter);
            int intNode = 0;
            if (objSource == Improvement.ImprovementSource.Bioware)
                intNode = 1;

            // Attempt to locate the selected piece of Cyberware.
            try
            {
                if (treCyberware.SelectedNode.Level > 0)
                    objSelectedCyberware = _objFunctions.FindCyberware(treCyberware.SelectedNode.Tag.ToString(), _objCharacter.Cyberware);
            }
            catch
            {
            }

            frmSelectCyberware frmPickCyberware = new frmSelectCyberware(_objCharacter, true);
            double dblMultiplier = 1;
            // Apply the character's Cyberware Essence cost multiplier if applicable.
            if (_objImprovementManager.ValueOf(Improvement.ImprovementType.CyberwareEssCost) != 0 && objSource == Improvement.ImprovementSource.Cyberware)
            {
                foreach (Improvement objImprovement in _objCharacter.Improvements)
                {
                    if (objImprovement.ImproveType == Improvement.ImprovementType.CyberwareEssCost && objImprovement.Enabled)
                        dblMultiplier -= (1 - (Convert.ToDouble(objImprovement.Value, GlobalOptions.Instance.CultureInfo) / 100));
                }
                frmPickCyberware.CharacterESSMultiplier = dblMultiplier;
            }

            // Apply the character's Bioware Essence cost multiplier if applicable.
            if (_objImprovementManager.ValueOf(Improvement.ImprovementType.BiowareEssCost) != 0 && objSource == Improvement.ImprovementSource.Bioware)
            {
                foreach (Improvement objImprovement in _objCharacter.Improvements)
                {
                    if (objImprovement.ImproveType == Improvement.ImprovementType.BiowareEssCost && objImprovement.Enabled)
                        dblMultiplier -= (1 - (Convert.ToDouble(objImprovement.Value, GlobalOptions.Instance.CultureInfo) / 100));
                }
                frmPickCyberware.CharacterESSMultiplier = dblMultiplier;
            }

            // Apply the character's Basic Bioware Essence cost multiplier if applicable.
            if (_objImprovementManager.ValueOf(Improvement.ImprovementType.BasicBiowareEssCost) != 0 && objSource == Improvement.ImprovementSource.Bioware)
            {
                double dblBasicMultiplier = 1;
                foreach (Improvement objImprovement in _objCharacter.Improvements)
                {
                    if (objImprovement.ImproveType == Improvement.ImprovementType.BasicBiowareEssCost && objImprovement.Enabled)
                        dblBasicMultiplier -= (1 - (Convert.ToDouble(objImprovement.Value, GlobalOptions.Instance.CultureInfo) / 100));
                }
                frmPickCyberware.BasicBiowareESSMultiplier = dblBasicMultiplier;
            }

            // Genetech Cost multiplier.
            if (_objImprovementManager.ValueOf(Improvement.ImprovementType.GenetechCostMultiplier) != 0 && objSource == Improvement.ImprovementSource.Bioware)
            {
                dblMultiplier = 1;
                foreach (Improvement objImprovement in _objCharacter.Improvements)
                {
                    if (objImprovement.ImproveType == Improvement.ImprovementType.GenetechCostMultiplier && objImprovement.Enabled)
                        dblMultiplier -= (1 - (Convert.ToDouble(objImprovement.Value, GlobalOptions.Instance.CultureInfo) / 100));
                }
                frmPickCyberware.GenetechCostMultiplier = dblMultiplier;
            }

            // Transgenics Cost multiplier.
            if (_objImprovementManager.ValueOf(Improvement.ImprovementType.TransgenicsBiowareCost) != 0 && objSource == Improvement.ImprovementSource.Bioware)
            {
                dblMultiplier = 1;
                foreach (Improvement objImprovement in _objCharacter.Improvements)
                {
                    if (objImprovement.ImproveType == Improvement.ImprovementType.TransgenicsBiowareCost && objImprovement.Enabled)
                        dblMultiplier -= (1 - (Convert.ToDouble(objImprovement.Value, GlobalOptions.Instance.CultureInfo) / 100));
                }
                frmPickCyberware.TransgenicsBiowareCostMultiplier = dblMultiplier;
            }

            try
            {
                if (treCyberware.SelectedNode.Level > 0)
                {
                    frmPickCyberware.SetGrade = lblCyberwareGrade.Text;
                    frmPickCyberware.LockGrade();
                    // If the Cyberware has a Capacity with no brackets (meaning it grants Capacity), show only Subsystems (those that conume Capacity).
                    if (!objSelectedCyberware.Capacity.Contains('['))
                    {
                        frmPickCyberware.ShowOnlySubsystems = true;
                        frmPickCyberware.Subsystems = objSelectedCyberware.Subsytems;
                        frmPickCyberware.MaximumCapacity = objSelectedCyberware.CapacityRemaining;

                        // Do not allow the user to add a new piece of Cyberware if its Capacity has been reached.
                        if (_objOptions.EnforceCapacity && objSelectedCyberware.CapacityRemaining < 0)
                        {
                            MessageBox.Show(LanguageManager.Instance.GetString("Message_CapacityReached"), LanguageManager.Instance.GetString("MessageTitle_CapacityReached"), MessageBoxButtons.OK, MessageBoxIcon.Information);
//.........这里部分代码省略.........
开发者ID:Althalusdlg,项目名称:chummer5a,代码行数:101,代码来源:frmCareer.cs


示例10: RefreshSelectedCyberware

        /// <summary>
        /// Refresh the information for the currently displayed piece of Cyberware.
        /// </summary>
        public void RefreshSelectedCyberware()
        {
            lblCyberDeviceRating.Visible = false;
            lblCyberAttack.Visible = false;
            lblCyberSleaze.Visible = false;
            lblCyberDataProcessing.Visible = false;
            lblCyberFirewall.Visible = false;
            lblCyberDeviceRatingLabel.Visible = false;
            lblCyberAttackLabel.Visible = false;
            lblCyberSleazeLabel.Visible = false;
            lblCyberDataProcessingLabel.Visible = false;
            lblCyberFirewallLabel.Visible = false;

            bool blnClear = false;
            try
            {
                if (treCyberware.SelectedNode.Level == 0)
                    blnClear = true;
            }
            catch
            {
                blnClear = true;
            }
            if (blnClear)
            {
                lblCyberwareName.Text = "";
                lblCyberwareCategory.Text = "";
                lblCyberwareRating.Text = "";
                lblCyberwareAvail.Text = "";
                lblCyberwareCost.Text = "";
                lblCyberwareCapacity.Text = "";
                lblCyberwareEssence.Text = "";
                lblCyberwareSource.Text = "";
                tipTooltip.SetToolTip(lblCyberwareSource, null);
                return;
            }

            // Locate the selected piece of Cyberware.
            bool blnFound = false;
            Cyberware objCyberware = _objFunctions.FindCyberware(treCyberware.SelectedNode.Tag.ToString(), _objCharacter.Cyberware);
            if (objCyberware != null)
                blnFound = true;

            if (blnFound)
            {
                _blnSkipRefresh = true;
                lblCyberwareName.Text = objCyberware.DisplayNameShort;
                lblCyberwareCategory.Text = objCyberware.DisplayCategory;
                string strBook = _objOptions.LanguageBookShort(objCyberware.Source);
                string strPage = objCyberware.Page;
                lblCyberwareSource.Text = strBook + " " + strPage;
                tipTooltip.SetToolTip(lblCyberwareSource, _objOptions.LanguageBookLong(objCyberware.Source) + " " + LanguageManager.Instance.GetString("String_Page") + " " + objCyberware.Page);
                lblCyberwareRating.Text = objCyberware.Rating.ToString();

                lblCyberwareGrade.Text = objCyberware.Grade.DisplayName;

                _blnSkipRefresh = false;

                lblCyberwareAvail.Text = objCyberware.TotalAvail;
                lblCyberwareCost.Text = String.Format("{0:###,###,##0¥}", objCyberware.TotalCost);
                lblCyberwareCapacity.Text = objCyberware.CalculatedCapacity + " (" + objCyberware.CapacityRemaining.ToString() + " " + LanguageManager.Instance.GetString("String_Remaining") + ")";
                lblCyberwareEssence.Text = objCyberware.CalculatedESS.ToString();
                UpdateCharacterInfo();
            }
            else
            {
                // Locate the selected piece of Gear.
                Cyberware objFoundCyberware = new Cyberware(_objCharacter);
                Gear objGear = _objFunctions.FindCyberwareGear(treCyberware.SelectedNode.Tag.ToString(), _objCharacter.Cyberware, out objFoundCyberware);

                if (objGear.GetType() == typeof(Commlink))
                {
                    Commlink objCommlink = (Commlink)objGear;
                    lblCyberDeviceRating.Text = objCommlink.TotalDeviceRating.ToString();
                    lblCyberAttack.Text = objCommlink.Attack.ToString();
                    lblCyberSleaze.Text = objCommlink.Sleaze.ToString();
                    lblCyberDataProcessing.Text = objCommlink.DataProcessing.ToString();
                    lblCyberFirewall.Text = objCommlink.Firewall.ToString();

                    lblCyberDeviceRating.Visible = true;
                    lblCyberAttack.Visible = true;
                    lblCyberSleaze.Visible = true;
                    lblCyberDataProcessing.Visible = true;
                    lblCyberFirewall.Visible = true;
                    lblCyberDeviceRatingLabel.Visible = true;
                    lblCyberAttackLabel.Visible = true;
                    lblCyberSleazeLabel.Visible = true;
                    lblCyberDataProcessingLabel.Visible = true;
                    lblCyberFirewallLabel.Visible = true;
                }
                else
                {
                    lblCyberDeviceRating.Visible = false;
                    lblCyberAttack.Visible = false;
                    lblCyberSleaze.Visible = false;
                    lblCyberDataProcessing.Visible = false;
                    lblCyberFirewall.Visible = false;
//.........这里部分代码省略.........
开发者ID:Althalusdlg,项目名称:chummer5a,代码行数:101,代码来源:frmCareer.cs


示例11: cmdDeleteCyberware_Click

        private void cmdDeleteCyberware_Click(object sender, EventArgs e)
        {
            try
            {
                if (treCyberware.SelectedNode.Level > 0)
                {
                    Cyberware objCyberware = new Cyberware(_objCharacter);
                    Cyberware objParent = new Cyberware(_objCharacter);
                    bool blnFound = false;
                    // Locate the piece of Cyberware that is selected in the tree.
                    objCyberware = _objFunctions.FindCyberware(treCyberware.SelectedNode.Tag.ToString(), _objCharacter.Cyberware);
                    if (objCyberware != null)
                    {
                        blnFound = true;
                        objParent = objCyberware.Parent;
                    }

                    if (blnFound)
                    {
                        if (objCyberware.Capacity == "[*]" && treCyberware.SelectedNode.Level == 2 && !_objCharacter.IgnoreRules)
                        {
                            MessageBox.Show(LanguageManager.Instance.GetString("Message_CannotRemoveCyberware"), LanguageManager.Instance.GetString("MessageTitle_CannotRemoveCyberware"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return;
                        }

                        if (objCyberware.SourceType == Improvement.ImprovementSource.Cyberware)
                        {
                            if (!_objFunctions.ConfirmDelete(LanguageManager.Instance.GetString("Message_DeleteCyberware")))
                                return;
                        }
                        if (objCyberware.SourceType == Improvement.ImprovementSource.Bioware)
                        {
                            if (!_objFunctions.ConfirmDelete(LanguageManager.Instance.GetString("Message_DeleteBioware")))
                                return;
                        }

                        // Run through the Cyberware's child elements and remove any Improvements and Cyberweapons.
                        foreach (Cyberware objChildCyberware in objCyberware.Children)
                        {
                            _objImprovementManager.RemoveImprovements(objCyberware.SourceType, objChildCyberware.InternalId);
                            if (objChildCyberware.WeaponID != Guid.Empty.ToString())
                            {
                                // Remove the Weapon from the TreeView.
                                TreeNode objRemoveNode = new TreeNode();
                                foreach (TreeNode objWeaponNode in treWeapons.Nodes[0].Nodes)
                                {
                                    if (objWeaponNode.Tag.ToString() == objChildCyberware.WeaponID)
                                        objRemoveNode = objWeaponNode;
                                }
                                treWeapons.Nodes.Remove(objRemoveNode);

                                // Remove the Weapon from the Character.
                                Weapon objRemoveWeapon = new Weapon(_objCharacter);
                                foreach (Weapon objWeapon in _objCharacter.Weapons)
                                {
                                    if (objWeapon.InternalId == objChildCyberware.WeaponID)
                                        objRemoveWeapon = objWeapon;
                                }
                                _objCharacter.Weapons.Remove(objRemoveWeapon);
                            }
                        }
                        // Remove the Children.
                        objCyberware.Children.Clear();

                        // Remove the Cyberweapon created by the Cyberware if applicable.
                        if (objCyberware.WeaponID != Guid.Empty.ToString())
                        {
                            // Remove the Weapon from the TreeView.
                            TreeNode objRemoveNode = new TreeNode();
                            foreach (TreeNode objWeaponNode in treWeapons.Nodes[0].Nodes)
                            {
                                if (objWeaponNode.Tag.ToString() == objCyberware.WeaponID)
                                    objRemoveNode = objWeaponNode;
                            }
                            treWeapons.Nodes.Remove(objRemoveNode);

                            // Remove the Weapon from the Character.
                            Weapon objRemoveWeapon = new Weapon(_objCharacter);
                            foreach (Weapon objWeapon in _objCharacter.Weapons)
                            {
                                if (objWeapon.InternalId == objCyberware.WeaponID)
                                    objRemoveWeapon = objWeapon;
                            }
                            _objCharacter.Weapons.Remove(objRemoveWeapon);

                            // Remove any Gear attached to the Cyberware.
                            foreach (Gear objGear in objCyberware.Gear)
                                _objFunctions.DeleteGear(objGear, treWeapons, _objImprovementManager);
                        }

                        // Remove any Gear attached to the Cyberware.
                        foreach (Gear objGear in objCyberware.Gear)
                            _objFunctions.DeleteGear(objGear, treWeapons, _objImprovementManager);

                        // Remove any Improvements created by the piece of Cyberware.
                        _objImprovementManager.RemoveImprovements(objCyberware.SourceType, objCyberware.InternalId);
                        _objCharacter.Cyberware.Remove(objCyberware);
                    }
                    else
                    {
//.........这里部分代码省略.........
开发者ID:knightaries,项目名称:chummer5a,代码行数:101,代码来源:frmCreate.cs


示例12: tsVehicleAddCyberware_Click

        private void tsVehicleAddCyberware_Click(object sender, EventArgs e)
        {
            Vehicle objVehicle = new Vehicle(_objCharacter);
            VehicleMod objMod = _objFunctions.FindVehicleMod(treVehicles.SelectedNode.Tag.ToString(), _objCharacter.Vehicles, out objVehicle);

            if (objMod == null)
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_VehicleCyberwarePlugin"), LanguageManager.Instance.GetString("MessageTitle_NoCyberware"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (!objMod.AllowCyberware)
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_VehicleCyberwarePlugin"), LanguageManager.Instance.GetString("MessageTitle_NoCyberware"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            frmSelectCyberware frmPickCyberware = new frmSelectCyberware(_objCharacter);
            frmPickCyberware.SetGrade = "Standard";
            frmPickCyberware.LockGrade();
            frmPickCyberware.ShowOnlySubsystems = true;
            frmPickCyberware.Subsystems = objMod.Subsystems;
            frmPickCyberware.AllowModularPlugins = objMod.AllowModularPlugins;
            frmPickCyberware.ShowDialog(this);

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

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

            XmlNode objXmlCyberware = objXmlDocument.SelectSingleNode("/chummer/cyberwares/cyberware[name = \"" + frmPickCyberware.SelectedCyberware + "\"]");

            // Create the Cyberware object.
            Cyberware objCyberware = new Cyberware(_objCharacter);
            List<Weapon> objWeapons = new List<Weapon>();
            TreeNode objNode = new TreeNode();
            List<TreeNode> objWeaponNodes = new List<TreeNode>();
            objCyberware.Create(objXmlCyberware, _objCharacter, frmPickCyberware.SelectedGrade, Improvement.ImprovementSource.Cyberware, frmPickCyberware.SelectedRating, objNode, objWeapons, objWeaponNodes, false);
            if (objCyberware.InternalId == Guid.Empty.ToString())
                return;

            if (frmPickCyberware.FreeCost)
                objCyberware.Cost = "0";

            int intCost = objCyberware.TotalCost;

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

            // Check the item's Cost and make sure the character can afford it.
            if (!frmPickCyberware.FreeCost)
            {
                if (intCost > _objCharacter.Nuyen)
                {
                    MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughNuyen"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughNuyen"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                else
                {
                    // Create the Expense Log Entry.
                    ExpenseLogEntry objExpense = new ExpenseLogEntry();
                    string strEntry = "";
                    strEntry = LanguageManager.Instance.GetString("String_ExpensePurchaseVehicleCyberware");
                    objExpense.Create(intCost * -1, strEntry + " " + objCyberware.DisplayNameShort, ExpenseType.Nuyen, DateTime.Now);
                    _objCharacter.ExpenseEntries.Add(objExpense);
                    _objCharacter.Nuyen -= intCost;

                    ExpenseUndo objUndo = new ExpenseUndo();
                    objUndo.CreateNuyen(NuyenExpenseType.AddVehicleModCyberware, objCyberware.InternalId);
                    objExpense.Undo = objUndo;
                }
            }

            treVehicles.SelectedNode.Nodes.Add(objNode);
            treVehicles.SelectedNode.Expand();
            objMod.Cyberware.Add(objCyberware);

            foreach (Weapon objWeapon in objWeapons)
            {
                objWeapon.VehicleMounted = true;
                objVehicle.Weapons.Add(objWeapon);
            }

            // Create the Weapon Node if one exists.
            foreach (TreeNode objWeaponNode in objWeaponNodes)
            {
                objWeaponNode.ContextMenuStrip = cmsVehicleWeapon;
                treVehicles.SelectedNode.Parent.Nodes.Add(objWeaponNode);
                treVehicles.SelectedNode.Parent.Expand();
            }

            UpdateCharacterInfo();

            _blnIsDirty = true;
            UpdateWindowTitle();

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


示例13: AddCyberwareSuite

        private void AddCyberwareSuite(Improvement.ImprovementSource objSource)
        {
            frmSelectCyberwareSuite frmPickCyberwareSuite = new frmSelectCyberwareSuite(objSource, _objCharacter);
            frmPickCyberwareSuite.ShowDialog(this);

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

            int intCost = frmPickCyberwareSuite.TotalCost;
            if (intCost > _objCharacter.Nuyen)
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughNuyen"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughNuyen"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            else
            {
                // Create the Expense Log Entry.
                ExpenseLogEntry objExpense = new ExpenseLogEntry();
                objExpense.Create(intCost * -1, LanguageManager.Instance.GetString("String_ExpensePurchaseCyberwareSuite") + " " + frmPickCyberwareSuite.SelectedSuite, ExpenseType.Nuyen, DateTime.Now);
                _objCharacter.ExpenseEntries.Add(objExpense);
    

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Cylinder类代码示例发布时间:2022-05-24
下一篇:
C# CvSize类代码示例发布时间: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