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

C# Chummer.frmSelectItem类代码示例

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

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



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

示例1: ProcessBonus

        private bool ProcessBonus(Improvement.ImprovementSource objImprovementSource, ref string strSourceName,
			bool blnConcatSelectedValue,
			int intRating, string strFriendlyName, XmlNode bonusNode, string strUnique)
        {
            Log.Info("Has Child Nodes");
            // Add an Attribute.
            if (bonusNode.LocalName == ("addattribute"))
            {
                Log.Info("addattribute");
                if (bonusNode["name"].InnerText == "MAG")
                {
                    _objCharacter.MAGEnabled = true;
                    Log.Info("Calling CreateImprovement for MAG");
                    CreateImprovement("MAG", objImprovementSource, strSourceName, Improvement.ImprovementType.Attribute,
                        "enableattribute", 0, 0);
                }
                else if (bonusNode["name"].InnerText == "RES")
                {
                    _objCharacter.RESEnabled = true;
                    Log.Info("Calling CreateImprovement for RES");
                    CreateImprovement("RES", objImprovementSource, strSourceName, Improvement.ImprovementType.Attribute,
                        "enableattribute", 0, 0);
                }
            }

            // Enable a special tab.
            if (bonusNode.LocalName == ("enabletab"))
            {
                Log.Info("enabletab");
                foreach (XmlNode objXmlEnable in bonusNode.ChildNodes)
                {
                    switch (objXmlEnable.InnerText)
                    {
                        case "magician":
                            _objCharacter.MagicianEnabled = true;
                            Log.Info("magician");
                            CreateImprovement("Magician", objImprovementSource, strSourceName, Improvement.ImprovementType.SpecialTab,
                                "enabletab", 0, 0);
                            break;
                        case "adept":
                            _objCharacter.AdeptEnabled = true;
                            Log.Info("adept");
                            CreateImprovement("Adept", objImprovementSource, strSourceName, Improvement.ImprovementType.SpecialTab,
                                "enabletab",
                                0, 0);
                            break;
                        case "technomancer":
                            _objCharacter.TechnomancerEnabled = true;
                            Log.Info("technomancer");
                            CreateImprovement("Technomancer", objImprovementSource, strSourceName, Improvement.ImprovementType.SpecialTab,
                                "enabletab", 0, 0);
                            break;
                        case "critter":
                            _objCharacter.CritterEnabled = true;
                            Log.Info("critter");
                            CreateImprovement("Critter", objImprovementSource, strSourceName, Improvement.ImprovementType.SpecialTab,
                                "enabletab", 0, 0);
                            break;
                        case "initiation":
                            _objCharacter.InitiationEnabled = true;
                            Log.Info("initiation");
                            CreateImprovement("Initiation", objImprovementSource, strSourceName, Improvement.ImprovementType.SpecialTab,
                                "enabletab", 0, 0);
                            break;
                    }
                }
            }

            // Select Restricted (select Restricted items for Fake Licenses).
            if (bonusNode.LocalName == ("selectrestricted"))
            {
                Log.Info("selectrestricted");
                frmSelectItem frmPickItem = new frmSelectItem();
                frmPickItem.Character = _objCharacter;
                if (_strForcedValue != string.Empty)
                    frmPickItem.ForceItem = _strForcedValue;
                frmPickItem.AllowAutoSelect = false;
                frmPickItem.ShowDialog();

                // Make sure the dialogue window was not canceled.
                if (frmPickItem.DialogResult == DialogResult.Cancel)
                {
                    Rollback();
                    _strForcedValue = "";
                    _strLimitSelection = "";
                    return false;
                }

                _strSelectedValue = frmPickItem.SelectedItem;
                if (blnConcatSelectedValue)
                    strSourceName += " (" + _strSelectedValue + ")";

                Log.Info("_strSelectedValue = " + _strSelectedValue);
                Log.Info("strSourceName = " + strSourceName);

                // Create the Improvement.
                Log.Info("Calling CreateImprovement");
                CreateImprovement(frmPickItem.SelectedItem, objImprovementSource, strSourceName,
                    Improvement.ImprovementType.Restricted, strUnique);
            }
//.........这里部分代码省略.........
开发者ID:Rockzo,项目名称:chummer5a,代码行数:101,代码来源:clsImprovement.cs


示例2: cmdCreateStackedFocus_Click

        private void cmdCreateStackedFocus_Click(object sender, EventArgs e)
        {
            int intFree = 0;
            List<Gear> lstGear = new List<Gear>();
            List<Gear> lstStack = new List<Gear>();

            // Run through all of the Foci the character has and count the un-Bonded ones.
            foreach (Gear objGear in _objCharacter.Gear)
            {
                if (objGear.Category == "Foci" || objGear.Category == "Metamagic Foci")
                {
                    if (!objGear.Bonded)
                    {
                        intFree++;
                        lstGear.Add(objGear);
                    }
                }
            }

            // If the character does not have at least 2 un-Bonded Foci, display an error and leave.
            if (intFree < 2)
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_CannotStackFoci"), LanguageManager.Instance.GetString("MessageTitle_CannotStackFoci"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            frmSelectItem frmPickItem = new frmSelectItem();

            // Let the character select the Foci they'd like to stack, stopping when they either click Cancel or there are no more items left in the list.
            do
            {
                frmPickItem.Gear = lstGear;
                frmPickItem.AllowAutoSelect = false;
                frmPickItem.Description = LanguageManager.Instance.GetString("String_SelectItemFocus");
                frmPickItem.ShowDialog(this);

                if (frmPickItem.DialogResult == DialogResult.OK)
                {
                    // Move the item from the Gear list to the Stack list.
                    foreach (Gear objGear in lstGear)
                    {
                        if (objGear.InternalId == frmPickItem.SelectedItem)
                        {
                            objGear.Bonded = true;
                            lstStack.Add(objGear);
                            lstGear.Remove(objGear);
                            break;
                        }
                    }
                }
            } while (lstGear.Count > 0 && frmPickItem.DialogResult != DialogResult.Cancel);

            // Make sure at least 2 Foci were selected.
            if (lstStack.Count < 2)
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_StackedFocusMinimum"), LanguageManager.Instance.GetString("MessageTitle_CannotStackFoci"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            // Make sure the combined Force of the Foci do not exceed 6.
            if (!_objOptions.AllowHigherStackedFoci)
            {
                int intCombined = 0;
                foreach (Gear objGear in lstStack)
                    intCombined += objGear.Rating;
                if (intCombined > 6)
                {
                    foreach (Gear objGear in lstStack)
                        objGear.Bonded = false;
                    MessageBox.Show(LanguageManager.Instance.GetString("Message_StackedFocusForce"), LanguageManager.Instance.GetString("MessageTitle_CannotStackFoci"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }

            // Create the Stacked Focus.
            StackedFocus objStack = new StackedFocus(_objCharacter);
            objStack.Gear = lstStack;
            _objCharacter.StackedFoci.Add(objStack);

            // Remove the Gear from the character and replace it with a Stacked Focus item.
            int intCost = 0;
            foreach (Gear objGear in lstStack)
            {
                intCost += objGear.TotalCost;
                _objCharacter.Gear.Remove(objGear);

                // Remove the TreeNode from Gear.
                foreach (TreeNode nodRoot in treGear.Nodes)
                {
                    foreach (TreeNode nodItem in nodRoot.Nodes)
                    {
                        if (nodItem.Tag.ToString() == objGear.InternalId)
                        {
                            nodRoot.Nodes.Remove(nodItem);
                            break;
                        }
                    }
                }
            }

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


示例3: cmdWeaponMoveToVehicle_Click

        private void cmdWeaponMoveToVehicle_Click(object sender, EventArgs e)
        {
            // Locate the selected Weapon.
            Weapon objWeapon = new Weapon(_objCharacter);
            foreach (Weapon objCharacterWeapon in _objCharacter.Weapons)
            {
                if (objCharacterWeapon.InternalId == treWeapons.SelectedNode.Tag.ToString())
                {
                    objWeapon = objCharacterWeapon;
                    break;
                }
            }

            List<Vehicle> lstVehicles = new List<Vehicle>();
            foreach (Vehicle objCharacterVehicle in _objCharacter.Vehicles)
            {
                foreach (VehicleMod objVehicleMod in objCharacterVehicle.Mods)
                {
                    // Only add a Vehicle to the list if it has a Weapon Mount or Mechanical Arm.
                    if (objVehicleMod.Name.StartsWith("Weapon Mount") || objVehicleMod.Name.StartsWith("Heavy Weapon Mount") || objVehicleMod.Name.StartsWith("Mechanical Arm"))
                    {
                        lstVehicles.Add(objCharacterVehicle);
                        break;
                    }
                }
            }

            // Cannot continue if there are no Vehicles with a Weapon Mount or Mechanical Arm.
            if (lstVehicles.Count == 0)
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_CannotMoveWeapons"), LanguageManager.Instance.GetString("MessageTitle_CannotMoveWeapons"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            frmSelectItem frmPickItem = new frmSelectItem();
            frmPickItem.Vehicles = lstVehicles;
            frmPickItem.ShowDialog(this);

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

            // Locate the selected Vehicle.
            Vehicle objVehicle = new Vehicle(_objCharacter);
            foreach (Vehicle objCharacterVehicle in _objCharacter.Vehicles)
            {
                if (objCharacterVehicle.InternalId == frmPickItem.SelectedItem)
                {
                    objVehicle = objCharacterVehicle;
                    break;
                }
            }

            // Now display a list of the acceptable mounting points for the Weapon.
            List<VehicleMod> lstMods = new List<VehicleMod>();
            foreach (VehicleMod objVehicleMod in objVehicle.Mods)
            {
                if (objVehicleMod.Name.StartsWith("Weapon Mount") || objVehicleMod.Name.StartsWith("Heavy Weapon Mount") || objVehicleMod.Name.StartsWith("Mechanical Arm"))
                    lstMods.Add(objVehicleMod);
            }

            frmPickItem.VehicleMods = lstMods;
            frmPickItem.ShowDialog(this);

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

            // Locate the selected Vehicle Mod.
            VehicleMod objMod = new VehicleMod(_objCharacter);
            foreach (VehicleMod objCharacterMod in objVehicle.Mods)
            {
                if (objCharacterMod.InternalId == frmPickItem.SelectedItem)
                {
                    objMod = objCharacterMod;
                    break;
                }
            }

            // Remove the Weapon from the character and add it to the Vehicle Mod.
            _objCharacter.Weapons.Remove(objWeapon);
            objMod.Weapons.Add(objWeapon);
            objWeapon.VehicleMounted = true;
            objWeapon.Location = string.Empty;

            // Move the TreeNode to the Vehicle Mod.
            TreeNode objNode = new TreeNode();
            objNode = treWeapons.SelectedNode;
            treWeapons.SelectedNode.Remove();

            foreach (TreeNode objVehicleNode in treVehicles.Nodes[0].Nodes)
            {
                foreach (TreeNode objModNode in objVehicleNode.Nodes)
                {
                    if (objModNode.Tag.ToString() == objMod.InternalId)
                    {
                        objModNode.Nodes.Add(objNode);
                        objModNode.Expand();
                        objNode.Expand();
                        break;
                    }
                }
//.........这里部分代码省略.........
开发者ID:Althalusdlg,项目名称:chummer5a,代码行数:101,代码来源:frmCareer.cs


示例4: cmdChangeSpec_Click

        private void cmdChangeSpec_Click(object sender, EventArgs e)
        {
            if (_objSkill.CharacterObject.Karma < _objSkill.CharacterObject.Options.KarmaSpecialization)
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughKarma"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughKarma"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

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

            // When the selected Knowledge Skill is changed, check the Skill file and build the pre-defined list of its Specializations (if any).
            List<ListItem> lstSpecializations = new List<ListItem>();
            XmlNode objXmlSkill;
            if (_objSkill.KnowledgeSkill)
            {
                objXmlSkill = objXmlDocument.SelectSingleNode("/chummer/knowledgeskills/skill[name = \"" + _objSkill.Name + "\"]");
                if (objXmlSkill == null)
                    objXmlSkill = objXmlDocument.SelectSingleNode("/chummer/knowledgeskills/skill[translate = \"" + _objSkill.Name + "\"]");
            }
            else
            {
                objXmlSkill = objXmlDocument.SelectSingleNode("/chummer/skills/skill[name = \"" + _objSkill.Name + "\"]");
                if (objXmlSkill == null)
                    objXmlSkill = objXmlDocument.SelectSingleNode("/chummer/skills/skill[translate = \"" + _objSkill.Name + "\"]");
            }
            if (objXmlSkill != null)
            {
                if (!_blnSkipRefresh)
                    cboKnowledgeSkillCategory.SelectedValue = objXmlSkill["category"].InnerText;
                cboSpec.Items.Clear();
                foreach (XmlNode objXmlSpecialization in objXmlSkill.SelectNodes("specs/spec"))
                {
                    bool blnFound = false;
                    foreach(SkillSpecialization objSpecialization in _objSkill.Specializations)
                    {
                        if (objSpecialization.Name == objXmlSpecialization.InnerText)
                        {
                            blnFound = true;
                            break;
                        }
                    }
                    if (!blnFound)
                    {
                        ListItem objItem = new ListItem();
                        if (objXmlSpecialization["translate"] != null)
                            objItem.Name = objXmlSpecialization["translate"].InnerText;
                        else
                            objItem.Name = objXmlSpecialization.InnerText;
                        objItem.Value = objItem.Name;
                        lstSpecializations.Add(objItem);
                    }
                }
            }

            if (!ConfirmKarmaExpense(LanguageManager.Instance.GetString("Message_ConfirmKarmaExpenseSkillSpecialization").Replace("{0}", _objSkill.CharacterObject.Options.KarmaSpecialization.ToString())))
                return;

            frmSelectItem frmPickItem = new frmSelectItem();
            frmPickItem.DropdownItems = lstSpecializations;
            frmPickItem.ShowDialog();

            if (frmPickItem.DialogResult == DialogResult.Cancel)
            {
                return;
            }

            string strSelectedValue = frmPickItem.SelectedItem;

            // charge the karma and add the spec
            SkillSpecialization objSpec = new SkillSpecialization(strSelectedValue);
            _objSkill.Specializations.Add(objSpec);

            // Create the Expense Log Entry.
            ExpenseLogEntry objEntry = new ExpenseLogEntry();
            objEntry.Create(_objSkill.CharacterObject.Options.KarmaSpecialization * -1, LanguageManager.Instance.GetString("String_ExpenseLearnSpecialization") + " " + _objSkill.Name + " (" + strSelectedValue + ")", ExpenseType.Karma, DateTime.Now);
            _objSkill.CharacterObject.ExpenseEntries.Add(objEntry);
            _objSkill.CharacterObject.Karma -= _objSkill.CharacterObject.Options.KarmaSpecialization;

            ExpenseUndo objUndo = new ExpenseUndo();
            objUndo.CreateKarma(KarmaExpenseType.AddSpecialization, objSpec.InternalId);
            objEntry.Undo = objUndo;

            lblSpec.Text = _objSkill.Specialization;

            this.Height = lblSpec.Height + 10;

            RatingChanged(this);
        }
开发者ID:ltdouthit,项目名称:chummer5a,代码行数:89,代码来源:SkillControl.cs


示例5: cmdGearMoveToVehicle_Click

        private void cmdGearMoveToVehicle_Click(object sender, EventArgs e)
        {
            frmSelectItem frmPickItem = new frmSelectItem();
            frmPickItem.Vehicles = _objCharacter.Vehicles;
            frmPickItem.ShowDialog(this);

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

            // Locate the selected Vehicle.
            Vehicle objVehicle = new Vehicle(_objCharacter);
            foreach (Vehicle objCharacterVehicle in _objCharacter.Vehicles)
            {
                if (objCharacterVehicle.InternalId == frmPickItem.SelectedItem)
                {
                    objVehicle = objCharacterVehicle;
                    break;
                }
            }

            Gear objSelectedGear = _objFunctions.FindGear(treGear.SelectedNode.Tag.ToString(), _objCharacter.Gear);
            int intMove = 0;
            if (objSelectedGear.Quantity == 1)
                intMove = 1;
            else
            {
                frmSelectNumber frmPickNumber = new frmSelectNumber();
                frmPickNumber.Minimum = 1;
                frmPickNumber.Maximum = objSelectedGear.Quantity;
                frmPickNumber.Description = LanguageManager.Instance.GetString("String_MoveGear");
                frmPickNumber.ShowDialog(this);

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

                intMove = frmPickNumber.SelectedValue;
            }

            // See if the Vehicle already has a matching piece of Gear.
            bool blnMatch = false;
            Gear objFoundGear = new Gear(_objCharacter);
            foreach (Gear objVehicleGear in objVehicle.Gear)
            {
                if (objVehicleGear.Name == objSelectedGear.Name && objVehicleGear.Category == objSelectedGear.Category && objVehicleGear.Rating == objSelectedGear.Rating && objVehicleGear.Extra == objSelectedGear.Extra && objVehicleGear.GearName == objSelectedGear.GearName && objVehicleGear.Notes == objSelectedGear.Notes)
                {
                    blnMatch = true;
                    objFoundGear = objVehicleGear;
                    if (objVehicleGear.Children.Count == objSelectedGear.Children.Count)
                    {
                        for (int i = 0; i <= objVehicleGear.Children.Count - 1; i++)
                        {
                            if (objVehicleGear.Children[i].Name != objSelectedGear.Children[i].Name || objVehicleGear.Children[i].Extra != objSelectedGear.Children[i].Extra || objVehicleGear.Children[i].Rating != objSelectedGear.Children[i].Rating)
                            {
                                blnMatch = false;
                                break;
                            }
                        }
                    }
                    else
                        blnMatch = false;
                }
            }

            if (!blnMatch)
            {
                // Create a new piece of Gear.
                TreeNode objGearNode = new TreeNode();
                List<Weapon> lstWeapons = new List<Weapon>();
                List<TreeNode> lstWeaponNodes = new List<TreeNode>();
                Gear objGear = new Gear(_objCharacter);
                if (objSelectedGear.GetType() == typeof(Commlink))
                {
                    Commlink objCommlink = new Commlink(_objCharacter);
                    objCommlink.Copy(objSelectedGear, objGearNode, lstWeapons, lstWeaponNodes);
                    objGear = objCommlink;
                }
                else
                    objGear.Copy(objSelectedGear, objGearNode, lstWeapons, lstWeaponNodes);

                objGear.Parent = null;
                objGear.Quantity = intMove;
                objGear.Location = string.Empty;
                objGearNode.Text = objGear.DisplayName;
                objGearNode.ContextMenuStrip = cmsVehicleGear;

                // Locate the Node for the selected Vehicle.
                TreeNode nodParent = new TreeNode();
                foreach (TreeNode nodNode in treVehicles.Nodes[0].Nodes)
                {
                    if (nodNode.Tag.ToString() == objVehicle.InternalId)
                    {
                        nodParent = nodNode;
                        break;
                    }
                }

                nodParent.Nodes.Add(objGearNode);
                objVehicle.Gear.Add(objGear);
            }
            else
//.........这里部分代码省略.........
开发者ID:Althalusdlg,项目名称:chummer5a,代码行数:101,代码来源:frmCareer.cs


示例6: cmdGearMergeQty_Click

        private void cmdGearMergeQty_Click(object sender, EventArgs e)
        {
            Gear objGear = _objFunctions.FindGear(treGear.SelectedNode.Tag.ToString(), _objCharacter.Gear);
            List<Gear> lstGear = new List<Gear>();

            foreach (Gear objCharacterGear in _objCharacter.Gear)
            {
                bool blnMatch = false;
                // Matches must happen on Name, Category, Rating, and Extra, plus all plugins.
                if (objCharacterGear.Name == objGear.Name && objCharacterGear.Category == objGear.Category && objCharacterGear.Rating == objGear.Rating && objCharacterGear.Extra == objGear.Extra && objCharacterGear.InternalId != objGear.InternalId)
                {
                    blnMatch = true;
                    if (objCharacterGear.Children.Count == objGear.Children.Count)
                    {
                        for (int i = 0; i <= objCharacterGear.Children.Count - 1; i++)
                        {
                            if (objCharacterGear.Children[i].Name != objGear.Children[i].Name || objCharacterGear.Children[i].Extra != objGear.Children[i].Extra || objCharacterGear.Children[i].Rating != objGear.Children[i].Rating)
                            {
                                blnMatch = false;
                                break;
                            }
                        }
                    }
                    else
                        blnMatch = false;
                }

                if (blnMatch)
                    lstGear.Add(objCharacterGear);
            }

            // If there were no matches, don't try to merge anything.
            if (lstGear.Count == 0)
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_CannotMergeGear"), LanguageManager.Instance.GetString("MessageTitle_CannotMergeGear"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            // Show the Select Item window.
            frmSelectItem frmPickItem = new frmSelectItem();
            frmPickItem.Gear = lstGear;
            frmPickItem.ShowDialog(this);

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

            Gear objSelectedGear = _objFunctions.FindGear(frmPickItem.SelectedItem, _objCharacter.Gear);

            frmSelectNumber frmPickNumber = new frmSelectNumber();
            frmPickNumber.Minimum = 1;
            frmPickNumber.Maximum = objGear.Quantity;
            frmPickNumber.Description = LanguageManager.Instance.GetString("String_MergeGear");
            frmPickNumber.ShowDialog(this);

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

            // Increase the quantity for the selected item.
            objSelectedGear.Quantity += frmPickNumber.SelectedValue;
            // Located the item in the Tree and update its display information.
            foreach (TreeNode objParent in treGear.Nodes)
            {
                foreach (TreeNode objNode in objParent.Nodes)
                {
                    if (objNode.Tag.ToString() == objSelectedGear.InternalId)
                    {
                        objNode.Text = objSelectedGear.DisplayName;
                        break;
                    }
                }
            }

            // Reduce the quantity for the selected item.
            objGear.Quantity -= frmPickNumber.SelectedValue;
            // If the quantity has reached 0, delete the item and any Weapons it created.
            if (objGear.Quantity == 0)
            {
                // Remove the Gear Weapon created by the Gear if applicable.
                if (objGear.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() == objGear.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 == objGear.WeaponID)
                            objRemoveWeapon = objWeapon;
                    }
                    _objCharacter.Weapons.Remove(objRemoveWeapon);
                }

                _objImprovementManager.RemoveImprovements(Improvement.ImprovementSource.Gear, objGear.InternalId);
//.........这里部分代码省略.........
开发者ID:Althalusdlg,项目名称:chummer5a,代码行数:101,代码来源:frmCareer.cs


示例7: mnuSpecialPossessInanimate_Click

        private void mnuSpecialPossessInanimate_Click(object sender, EventArgs e)
        {
            // Make sure the Spirit has been saved first.
            if (_blnIsDirty)
            {
                if (MessageBox.Show(LanguageManager.Instance.GetString("Message_PossessionSave"), LanguageManager.Instance.GetString("MessageTitle_Possession"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.No)
                    return;
            }

            // Prompt the user to select an inanimate Vessel.
            XmlDocument objVesselDoc = XmlManager.Instance.Load("vessels.xml");
            XmlNodeList objXmlMetatypeList = objVesselDoc.SelectNodes("/chummer/metatypes/metatype");
            List<ListItem> lstMetatype = new List<ListItem>();
            foreach (XmlNode objXmlMetatype in objXmlMetatypeList)
            {
                ListItem objItem = new ListItem();
                objItem.Value = objXmlMetatype["name"].InnerText;
                if (objXmlMetatype["translate"] != null)
                    objItem.Name = objXmlMetatype["translate"].InnerText;
                else
                    objItem.Name = objXmlMetatype["name"].InnerText;
                lstMetatype.Add(objItem);
            }

            frmSelectItem frmSelectVessel = new frmSelectItem();
            frmSelectVessel.GeneralItems = lstMetatype;
            frmSelectVessel.ShowDialog(this);

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

            // Load the Spirit's save file into a new Merge character.
            Character objMerge = new Character();
            objMerge.FileName = _objCharacter.FileName;
            objMerge.Load();
            objMerge.Possessed = true;
            objMerge.Alias = frmSelectVessel.SelectedItem + " (" + LanguageManager.Instance.GetString("String_Possessed") + ")";

            // Get the Node for the selected Vessel.
            XmlNode objSelected = objVesselDoc.SelectSingleNode("/chummer/metatypes/metatype[name = \"" + frmSelectVessel.SelectedItem + "\"]");

            // Get the Attribute Modifiers for the Vessel.
            int intBOD = Convert.ToInt32(objSelected["bodmin"].InnerText);
            int intAGI = Convert.ToInt32(objSelected["agimin"].InnerText);
            int intREA = Convert.ToInt32(objSelected["reamin"].InnerText);
            int intSTR = Convert.ToInt32(objSelected["strmin"].InnerText);

            // Add the Attribute modifiers, making sure that none of them go below 1.
            int intSetBOD = objMerge.MAG.TotalValue + intBOD;
            int intSetAGI = objMerge.MAG.TotalValue + intAGI;
            int intSetREA = objMerge.MAG.TotalValue + intREA;
            int intSetSTR = objMerge.MAG.TotalValue + intSTR;

            objMerge.BOD.MetatypeMinimum += intBOD;
            if (objMerge.BOD.MetatypeMinimum < 1)
                objMerge.BOD.MetatypeMinimum = 1;
            objMerge.BOD.MetatypeMaximum += intBOD;
            if (objMerge.BOD.MetatypeMaximum < 1)
                objMerge.BOD.MetatypeMaximum = 1;
            objMerge.BOD.Value = intSetBOD;
            if (objMerge.BOD.Value < 1)
                objMerge.BOD.Value = 1;

            objMerge.AGI.MetatypeMinimum += intAGI;
            if (objMerge.AGI.MetatypeMinimum < 1)
                objMerge.AGI.MetatypeMinimum = 1;
            objMerge.AGI.MetatypeMaximum += intAGI;
            if (objMerge.AGI.MetatypeMaximum < 1)
                objMerge.AGI.MetatypeMaximum = 1;
            objMerge.AGI.Value = intSetAGI;
            if (objMerge.AGI.Value < 1)
                objMerge.AGI.Value = 1;

            objMerge.REA.MetatypeMinimum += intREA;
            if (objMerge.REA.MetatypeMinimum < 1)
                objMerge.REA.MetatypeMinimum = 1;
            objMerge.REA.MetatypeMaximum += intREA;
            if (objMerge.REA.MetatypeMaximum < 1)
                objMerge.REA.MetatypeMaximum = 1;
            objMerge.REA.Value = intSetREA;
            if (objMerge.REA.Value < 1)
                objMerge.REA.Value = 1;

            objMerge.STR.MetatypeMinimum += intSTR;
            if (objMerge.STR.MetatypeMinimum < 1)
                objMerge.STR.MetatypeMinimum = 1;
            objMerge.STR.MetatypeMaximum += intSTR;
            if (objMerge.STR.MetatypeMaximum < 1)
                objMerge.STR.MetatypeMaximum = 1;
            objMerge.STR.Value = intSetSTR;
            if (objMerge.STR.Value < 1)
                objMerge.STR.Value = 1;

            // Update the Movement if the Vessel has one.
            if (objSelected["movement"] != null)
                objMerge.Movement = objSelected["movement"].InnerText;

            // Add any additional Critter Powers the Vessel grants.
            if (objSelected["powers"] != null)
            {
//.........这里部分代码省略.........
开发者ID:Althalusdlg,项目名称:chummer5a,代码行数:101,代码来源:frmCareer.cs


示例8: CreateImprovements


//.........这里部分代码省略.........
                if (NodeExists(nodBonus, "enabletab"))
                {
                    foreach (XmlNode objXmlEnable in nodBonus["enabletab"].ChildNodes)
                    {
                        switch (objXmlEnable.InnerText)
                        {
                            case "magician":
                                _objCharacter.MagicianEnabled = true;
                                CreateImprovement("Magician", objImprovementSource, strSourceName, Improvement.ImprovementType.SpecialTab, "enabletab", blnConditional, 0, 0);
                                break;
                            case "adept":
                                _objCharacter.AdeptEnabled = true;
                                CreateImprovement("Adept", objImprovementSource, strSourceName, Improvement.ImprovementType.SpecialTab, "enabletab", blnConditional, 0, 0);
                                break;
                            case "technomancer":
                                _objCharacter.TechnomancerEnabled = true;
                                CreateImprovement("Technomancer", objImprovementSource, strSourceName, Improvement.ImprovementType.SpecialTab, "enabletab", blnConditional, 0, 0);
                                break;
                            case "critter":
                                _objCharacter.CritterEnabled = true;
                                CreateImprovement("Critter", objImprovementSource, strSourceName, Improvement.ImprovementType.SpecialTab, "enabletab", blnConditional, 0, 0);
                                break;
                            case "initiation":
                                _objCharacter.InitiationEnabled = true;
                                CreateImprovement("Initiation", objImprovementSource, strSourceName, Improvement.ImprovementType.SpecialTab, "enabletab", blnConditional, 0, 0);
                                break;
                        }
                    }
                }

                // Select Restricted (select Restricted items for Fake Licenses).
                if (NodeExists(nodBonus, "selectrestricted"))
                {
                    frmSelectItem frmPickItem = new frmSelectItem();
                    frmPickItem.Character = _objCharacter;
                    if (_strForcedValue != string.Empty)
                        frmPickItem.ForceItem = _strForcedValue;
                    frmPickItem.AllowAutoSelect = false;
                    frmPickItem.ShowDialog();

                    // Make sure the dialogue window was not canceled.
                    if (frmPickItem.DialogResult == DialogResult.Cancel)
                    {
                        Rollback();
                        blnSuccess = false;
                        _strForcedValue = "";
                        _strLimitSelection = "";
                        return false;
                    }

                    _strSelectedValue = frmPickItem.SelectedItem;
                    if (blnConcatSelectedValue)
                        strSourceName += " (" + _strSelectedValue + ")";

                    // Create the Improvement.
                    CreateImprovement(frmPickItem.SelectedItem, objImprovementSource, strSourceName, Improvement.ImprovementType.Restricted, strUnique, blnConditional);
                }

                // Select a Skill.
                if (NodeExists(nodBonus, "selectskill"))
                {
                    // Display the Select Skill window and record which Skill was selected.
                    frmSelectSkill frmPickSkill = new frmSelectSkill(_objCharacter);
                    if (strFriendlyName != "")
                        frmPickSkill.Description = LanguageManager.Instance.GetString("String_Improvement_SelectSkillNamed").Replace("{0}", strFriendlyName);
                    else
开发者ID:janhelke,项目名称:chummer2,代码行数:67,代码来源:clsImprovement.cs


示例9: CreateImprovements


//.........这里部分代码省略.........
                                case "magician":
                                    _objCharacter.MagicianEnabled = true;
                                    objFunctions.LogWrite(CommonFunctions.LogType.Message, "Chummer.ImprovementManager", "magician");
                                    CreateImprovement("Magician", objImprovementSource, strSourceName, Improvement.ImprovementType.SpecialTab, "enabletab", 0, 0);
                                    break;
                                case "adept":
                                    _objCharacter.AdeptEnabled = true;
                                    objFunctions.LogWrite(CommonFunctions.LogType.Message, "Chummer.ImprovementManager", "adept");
                                    CreateImprovement("Adept", objImprovementSource, strSourceName, Improvement.ImprovementType.SpecialTab, "enabletab", 0, 0);
                                    break;
                                case "technomancer":
                                    _objCharacter.TechnomancerEnabled = true;
                                    objFunctions.LogWrite(CommonFunctions.LogType.Message, "Chummer.ImprovementManager", "technomancer");
                                    CreateImprovement("Technomancer", objImprovementSource, strSourceName, Improvement.ImprovementType.SpecialTab, "enabletab", 0, 0);
                                    break;
                                case "critter":
                                    _objCharacter.CritterEnabled = true;
                                    objFunctions.LogWrite(CommonFunctions.LogType.Message, "Chummer.ImprovementManager", "critter");
                                    CreateImprovement("Critter", objImprovementSource, strSourceName, Improvement.ImprovementType.SpecialTab, "enabletab", 0, 0);
                                    break;
                                case "initiation":
                                    _objCharacter.InitiationEnabled = true;
                                    objFunctions.LogWrite(CommonFunctions.LogType.Message, "Chummer.ImprovementManager", "initiation");
                                    CreateImprovement("Initiation", objImprovementSource, strSourceName, Improvement.ImprovementType.SpecialTab, "enabletab", 0, 0);
                                    break;
                            }
                        }
                    }

                    // Select Restricted (select Restricted items for Fake Licenses).
                    if (NodeExists(nodBonus, "selectrestricted"))
                    {
                        objFunctions.LogWrite(CommonFunctions.LogType.Message, "Chummer.ImprovementManager", "selectrestricted");
                        frmSelectItem frmPickItem = new frmSelectItem();
                        frmPickItem.Character = _objCharacter;
                        if (_strForcedValue != string.Empty)
                            frmPickItem.ForceItem = _strForcedValue;
                        frmPickItem.AllowAutoSelect = false;
                        frmPickItem.ShowDialog();

                        // Make sure the dialogue window was not canceled.
                        if (frmPickItem.DialogResult == DialogResult.Cancel)
                        {
                            Rollback();
                            blnSuccess = false;
                            _strForcedValue = "";
                            _strLimitSelection = "";
                            return false;
                        }

                        _strSelectedValue = frmPickItem.SelectedItem;
                        if (blnConcatSelectedValue)
                            strSourceName += " (" + _strSelectedValue + ")";

                        objFunctions.LogWrite(CommonFunctions.LogType.Content, "Chummer.ImprovementManager", "_strSelectedValue = " + _strSelectedValue);
                        objFunctions.LogWrite(CommonFunctions.LogType.Content, "Chummer.ImprovementManager", "strSourceName = " + strSourceName);

                        // Create the Improvement.
                        objFunctions.LogWrite(CommonFunctions.LogType.Message, "Chummer.ImprovementManager", "Calling CreateImprovement");
                        CreateImprovement(frmPickItem.SelectedItem, objImprovementSource, strSourceName, Improvement.ImprovementType.Restricted, strUnique);
                    }

                    // Select a Skill.
                    if (NodeExists(nodBonus, "selectskill"))
                    {
                        objFunctions.LogWrite(CommonFunctions.LogType.Message, "Chummer.ImprovementManager", "selectrestricted");
开发者ID:kingcortez905,项目名称:chummer5,代码行数:67,代码来源:clsImprovement.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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