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

C# Chummer.MartialArt类代码示例

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

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



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

示例1: cmdDeleteMartialArt_Click

        private void cmdDeleteMartialArt_Click(object sender, EventArgs e)
        {
            try
            {
                if (treMartialArts.SelectedNode.Level == 0)
                    return;

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

                if (treMartialArts.SelectedNode.Level == 1)
                {
                    // Delete the selected Martial Art.
                    MartialArt objMartialArt = _objFunctions.FindMartialArt(treMartialArts.SelectedNode.Tag.ToString(), _objCharacter.MartialArts);

                    if (objMartialArt.Name == "One Trick Pony")
                    {
                        foreach (Quality objQuality in _objCharacter.Qualities)
                        {
                            if (objQuality.Name == "One Trick Pony")
                            {
                                _objCharacter.Qualities.Remove(objQuality);
                                foreach (TreeNode nodQuality in treQualities.Nodes[0].Nodes)
                                {
                                    if (nodQuality.Text.ToString() == "One Trick Pony")
                                        nodQuality.Remove();
                                }
                                break;
                            }
                        }
                    }

                    // Remove the Improvements for any Advantages for the Martial Art that is being removed.
                    foreach (MartialArtAdvantage objAdvantage in objMartialArt.Advantages)
                    {
                        _objImprovementManager.RemoveImprovements(Improvement.ImprovementSource.MartialArtAdvantage, objAdvantage.InternalId);
                    }

                    _objCharacter.MartialArts.Remove(objMartialArt);
                    treMartialArts.SelectedNode.Remove();

                    CalculateBP();
                    UpdateCharacterInfo();

                    _blnIsDirty = true;
                    UpdateWindowTitle();
                }
                if (treMartialArts.SelectedNode.Level == 2)
                {
                    // Find the selected Advantage object.
                    MartialArt objSelectedMartialArt = new MartialArt(_objCharacter);
                    MartialArtAdvantage objSelectedAdvantage = _objFunctions.FindMartialArtAdvantage(treMartialArts.SelectedNode.Tag.ToString(), _objCharacter.MartialArts, out objSelectedMartialArt);

                    _objImprovementManager.RemoveImprovements(Improvement.ImprovementSource.MartialArtAdvantage, objSelectedAdvantage.InternalId);
                    treMartialArts.SelectedNode.Remove();

                    objSelectedMartialArt.Advantages.Remove(objSelectedAdvantage);

                    CalculateBP();
                    UpdateCharacterInfo();

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


示例2: tsAddTechniqueNotes_Click

        private void tsAddTechniqueNotes_Click(object sender, EventArgs e)
        {
            try
            {
                bool blnFound = false;
                MartialArt objMartialArt = new MartialArt(_objCharacter);
                MartialArtAdvantage objTechnique = _objFunctions.FindMartialArtAdvantage(treMartialArts.SelectedNode.Tag.ToString(), _objCharacter.MartialArts, out objMartialArt);
                if (objTechnique != null)
                    blnFound = true;

                if (blnFound)
                {
                    frmNotes frmItemNotes = new frmNotes();
                    frmItemNotes.Notes = objTechnique.Notes;
                    string strOldValue = objTechnique.Notes;
                    frmItemNotes.ShowDialog(this);

                    if (frmItemNotes.DialogResult == DialogResult.OK)
                    {
                        objTechnique.Notes = frmItemNotes.Notes;
                        if (objTechnique.Notes != strOldValue)
                        {
                            _blnIsDirty = true;
                            UpdateWindowTitle();
                        }
                    }

                    if (objTechnique.Notes != string.Empty)
                        treMartialArts.SelectedNode.ForeColor = Color.SaddleBrown;
                    else
                        treMartialArts.SelectedNode.ForeColor = SystemColors.WindowText;
                    treMartialArts.SelectedNode.ToolTipText = CommonFunctions.WordWrap(objTechnique.Notes, 100);
                }
            }
            catch
            {
            }
        }
开发者ID:cormanater,项目名称:chummer5a,代码行数:38,代码来源:frmCreate.cs


示例3: cmdAddMartialArt_Click

        private void cmdAddMartialArt_Click(object sender, EventArgs e)
        {
            frmSelectMartialArt frmPickMartialArt = new frmSelectMartialArt(_objCharacter);
            frmPickMartialArt.ShowDialog(this);

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

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

            XmlNode objXmlArt = objXmlDocument.SelectSingleNode("/chummer/martialarts/martialart[name = \"" + frmPickMartialArt.SelectedMartialArt + "\"]");

            TreeNode objNode = new TreeNode();
            MartialArt objMartialArt = new MartialArt(_objCharacter);
            objMartialArt.Create(objXmlArt, objNode, _objCharacter);
            _objCharacter.MartialArts.Add(objMartialArt);

            objNode.ContextMenuStrip = cmsMartialArts;

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

            treMartialArts.SelectedNode = objNode;

            treMartialArts.SortCustom();
            CalculateBP();
            CalculateNuyen();

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


示例4: Load


//.........这里部分代码省略.........
            objSort = new SortListItem();
            lstPowerOrder.Sort(objSort.Compare);

            foreach (ListItem objItem in lstPowerOrder)
            {
                Power objPower = new Power(this);
                XmlNode objNode = objXmlDocument.SelectSingleNode("/character/powers/power[name = " + CleanXPath(objItem.Name) + " and extra = " + CleanXPath(objItem.Value) + "]");
                objPower.Load(objNode);
                _lstPowers.Add(objPower);
            }

            // Spirits/Sprites.
            objXmlNodeList = objXmlDocument.SelectNodes("/character/spirits/spirit");
            foreach (XmlNode objXmlSpirit in objXmlNodeList)
            {
                Spirit objSpirit = new Spirit(this);
                objSpirit.Load(objXmlSpirit);
                _lstSpirits.Add(objSpirit);
            }

            // Compex Forms/Technomancer Programs.
            objXmlNodeList = objXmlDocument.SelectNodes("/character/complexforms/complexform");
            foreach (XmlNode objXmlProgram in objXmlNodeList)
            {
                ComplexForm objProgram = new ComplexForm(this);
                objProgram.Load(objXmlProgram);
                _lstComplexForms.Add(objProgram);
            }

            // Martial Arts.
            objXmlNodeList = objXmlDocument.SelectNodes("/character/martialarts/martialart");
            foreach (XmlNode objXmlArt in objXmlNodeList)
            {
                MartialArt objMartialArt = new MartialArt(this);
                objMartialArt.Load(objXmlArt);
                _lstMartialArts.Add(objMartialArt);
            }

            // Martial Art Maneuvers.
            objXmlNodeList = objXmlDocument.SelectNodes("/character/martialartmaneuvers/martialartmaneuver");
            foreach (XmlNode objXmlManeuver in objXmlNodeList)
            {
                MartialArtManeuver objManeuver = new MartialArtManeuver(this);
                objManeuver.Load(objXmlManeuver);
                _lstMartialArtManeuvers.Add(objManeuver);
            }

            // Limit Modifiers.
            objXmlNodeList = objXmlDocument.SelectNodes("/character/limitmodifiers/limitmodifier");
            foreach (XmlNode objXmlLimit in objXmlNodeList)
            {
                LimitModifier obLimitModifier = new LimitModifier(this);
                obLimitModifier.Load(objXmlLimit);
                _lstLimitModifiers.Add(obLimitModifier);
            }

            // Lifestyles.
            objXmlNodeList = objXmlDocument.SelectNodes("/character/lifestyles/lifestyle");
            foreach (XmlNode objXmlLifestyle in objXmlNodeList)
            {
                Lifestyle objLifestyle = new Lifestyle(this);
                objLifestyle.Load(objXmlLifestyle);
                _lstLifestyles.Add(objLifestyle);
            }

            // <gears>
开发者ID:ercflemng,项目名称:chummer5a,代码行数:67,代码来源:clsCharacter.cs


示例5: AddPACKSKit


//.........这里部分代码省略.........
					objSkillControl.Location = new Point(0, objSkillControl.Height * i + panKnowledgeSkills.AutoScrollPosition.Y);
                    panKnowledgeSkills.Controls.Add(objSkillControl);

                    objSkillControl.SkillName = objXmlSkill["name"].InnerText;

                    // Make sure it's not going above the maximum number.
                    if (Convert.ToInt32(objXmlSkill["rating"].InnerText) > objSkillControl.SkillRatingMaximum)
                        objSkillControl.SkillRating = objSkillControl.SkillRatingMaximum;
                    else
                        objSkillControl.SkillRating = Convert.ToInt32(objXmlSkill["rating"].InnerText);

                    if (objXmlSkill["spec"] != null)
                        objSkillControl.SkillSpec = objXmlSkill["spec"].InnerText;
                    else
                        objSkillControl.SkillSpec = "";

                    if (objXmlSkill["category"] != null)
                        objSkillControl.SkillCategory = objXmlSkill["category"].InnerText;

                    _objCharacter.Skills.Add(objSkill);
                }
            }

            // Select a Martial Art.
            if (objXmlKit["selectmartialart"] != null)
            {
                string strForcedValue = "";
                int intRating = 1;
                if (objXmlKit["selectmartialart"].Attributes["select"] != null)
                    strForcedValue = objXmlKit["selectmartialart"].Attributes["select"].InnerText;
                if (objXmlKit["selectmartialart"].Attributes["rating"] != null)
                    intRating = Convert.ToInt32(objXmlKit["selectmartialart"].Attributes["rating"].InnerText);

                frmSelectMartialArt frmPickMartialArt = new frmSelectMartialArt(_objCharacter);
                frmPickMartialArt.ForcedValue = strForcedValue;
                frmPickMartialArt.ShowDialog(this);

                if (frmPickMartialArt.DialogResult != DialogResult.Cancel)
                {
                    // Open the Martial Arts XML file and locate the selected piece.
                    XmlDocument objXmlMartialArtDocument = XmlManager.Instance.Load("martialarts.xml");

                    XmlNode objXmlArt = objXmlMartialArtDocument.SelectSingleNode("/chummer/martialarts/martialart[name = \"" + frmPickMartialArt.SelectedMartialArt + "\"]");

                    TreeNode objNode = new TreeNode();
                    MartialArt objMartialArt = new MartialArt(_objCharacter);
                    objMartialArt.Create(objXmlArt, objNode, _objCharacter);
                    objMartialArt.Rating = intRating;
                    _objCharacter.MartialArts.Add(objMartialArt);

                    objNode.ContextMenuStrip = cmsMartialArts;

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

                    treMartialArts.SelectedNode = objNode;
                }
            }

            // Update Martial Arts.
            if (objXmlKit["martialarts"] != null)
            {
                // Open the Martial Arts XML file and locate the selected art.
                XmlDocument objXmlMartialArtDocument = XmlManager.Instance.Load("martialarts.xml");

                foreach (XmlNode objXmlArt in objXmlKit.SelectNodes("martialarts/martialart"))
开发者ID:cormanater,项目名称:chummer5a,代码行数:67,代码来源:frmCreate.cs


示例6: FindMartialArtAdvantage

        /// <summary>
        /// Locate a Martial Art Advantage within the character's Martial Arts.
        /// </summary>
        /// <param name="strGuid">InternalId of the Martial Art Advantage to find.</param>
        /// <param name="lstMartialArts">List of Martial Arts to search.</param>
        /// <param name="objFoundMartialArt">MartialArt the Advantage was found in.</param>
        public MartialArtAdvantage FindMartialArtAdvantage(string strGuid, List<MartialArt> lstMartialArts, out MartialArt objFoundMartialArt)
        {
            foreach (MartialArt objArt in lstMartialArts)
            {
                foreach (MartialArtAdvantage objAdvantage in objArt.Advantages)
                {
                    if (objAdvantage.InternalId == strGuid)
                    {
                        objFoundMartialArt = objArt;
                        return objAdvantage;
                    }
                }
            }

            objFoundMartialArt = null;
            return null;
        }
开发者ID:hollis21,项目名称:Chummer,代码行数:23,代码来源:clsCommon.cs


示例7: ProcessBonus


//.........这里部分代码省略.........
                if (bonusNode["bonus"] != null)
                {
                    Log.Info("Calling CreateImprovement for bonus");
                    CreateImprovement(bonusNode["name"].InnerText, objImprovementSource, strSourceName,
                        Improvement.ImprovementType.Skill, strUseUnique, ValueToInt(bonusNode["bonus"].InnerXml, intRating), 1, 0, 0, 0,
                        0, "", blnAddToRating);
                }
                if (bonusNode["max"] != null)
                {
                    Log.Info("Calling CreateImprovement for max");
                    CreateImprovement(bonusNode["name"].InnerText, objImprovementSource, strSourceName,
                        Improvement.ImprovementType.Skill, strUseUnique, 0, 1, 0, ValueToInt(bonusNode["max"].InnerText, intRating), 0,
                        0,
                        "", blnAddToRating);
                }
            }

            if (bonusNode.LocalName == "reflexrecorderoptimization")
            {
                CreateImprovement("", objImprovementSource, strSourceName, Improvement.ImprovementType.ReflexRecorderOptimization, strUnique);
            }

            // The Improvement adds a martial art
            if (bonusNode.LocalName == ("martialart"))
            {
                Log.Info("martialart");
                Log.Info("martialart = " + bonusNode.OuterXml.ToString());
                XmlDocument _objXmlDocument = XmlManager.Instance.Load("martialarts.xml");
                XmlNode objXmlArt =
                    _objXmlDocument.SelectSingleNode("/chummer/martialarts/martialart[name = \"" + bonusNode.InnerText +
                                                     "\"]");

                TreeNode objNode = new TreeNode();
                MartialArt objMartialArt = new MartialArt(_objCharacter);
                objMartialArt.Create(objXmlArt, objNode, _objCharacter);
                objMartialArt.IsQuality = true;
                _objCharacter.MartialArts.Add(objMartialArt);
            }

            // The Improvement adds a limit modifier
            if (bonusNode.LocalName == ("limitmodifier"))
            {
                Log.Info("limitmodifier");
                Log.Info("limitmodifier = " + bonusNode.OuterXml.ToString());
                LimitModifier objLimitMod = new LimitModifier(_objCharacter);
                string strLimit = bonusNode["limit"].InnerText;
                string strBonus = bonusNode["value"].InnerText;
                if (strBonus == "Rating")
                {
                    strBonus = intRating.ToString();
                }
                string strCondition = "";
                try
                {
                    strCondition = bonusNode["condition"].InnerText;
                }
                catch
                {
                }
                int intBonus = 0;
                if (strBonus == "Rating")
                    intBonus = intRating;
                else
                    intBonus = Convert.ToInt32(strBonus);
                string strName = strFriendlyName;
                TreeNode nodTemp = new TreeNode();
开发者ID:Rockzo,项目名称:chummer5a,代码行数:67,代码来源:clsImprovement.cs


示例8: cmdAddMartialArt_Click

        private void cmdAddMartialArt_Click(object sender, EventArgs e)
        {
            // Make sure that adding a new Martial Art will not take the user over 35 BP for Positive Qualities.
            if (!_objCharacter.IgnoreRules)
            {
                // Count the BP used by Positive Qualities.
                int intBP = 0;
                foreach (Quality objQuality in _objCharacter.Qualities)
                {
                    if (objQuality.Type == QualityType.Positive && objQuality.ContributeToLimit)
                        intBP += objQuality.Cost;
                }
                // Include free Positive Quality Improvements.
                intBP -= _objImprovementManager.ValueOf(Improvement.ImprovementType.FreePositiveQualities);

                if (_objCharacter.BuildMethod == CharacterBuildMethod.Karma)
                    intBP *= _objOptions.KarmaQuality;

                // Add 5 which is the cost for a new Martial Art at Rating 1.
                if (_objCharacter.BuildMethod == CharacterBuildMethod.BP)
                    intBP += 5;
                else
                    intBP += (5 * _objOptions.KarmaQuality);

                foreach (MartialArt objCharacterMartialArt in _objCharacter.MartialArts)
                {
                    if (_objCharacter.BuildMethod == CharacterBuildMethod.BP)
                        intBP += objCharacterMartialArt.Rating * 5;
                    else
                        intBP += objCharacterMartialArt.Rating * 5 * _objOptions.KarmaQuality;
                }

                if (_objCharacter.BuildMethod == CharacterBuildMethod.BP)
                {
                    if (intBP > 35 && !_objCharacter.IgnoreRules)
                    {
                        MessageBox.Show(LanguageManager.Instance.GetString("Message_PositiveQualityLimit").Replace("{0}", "35 " + LanguageManager.Instance.GetString("String_BP")), LanguageManager.Instance.GetString("MessageTitle_PositiveQualityLimit"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                }
                else
                {
                    if (intBP > 70 && !_objCharacter.IgnoreRules)
                    {
                        MessageBox.Show(LanguageManager.Instance.GetString("Message_PositiveQualityLimit").Replace("{0}", "70 " + LanguageManager.Instance.GetString("String_Karma")), LanguageManager.Instance.GetString("MessageTitle_PositiveQualityLimit"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                }
            }

            frmSelectMartialArt frmPickMartialArt = new frmSelectMartialArt(_objCharacter);
            frmPickMartialArt.ShowDialog(this);

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

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

            XmlNode objXmlArt = objXmlDocument.SelectSingleNode("/chummer/martialarts/martialart[name = \"" + frmPickMartialArt.SelectedMartialArt + "\"]");

            TreeNode objNode = new TreeNode();
            MartialArt objMartialArt = new MartialArt(_objCharacter);
            objMartialArt.Create(objXmlArt, objNode, _objCharacter);
            _objCharacter.MartialArts.Add(objMartialArt);

            objNode.ContextMenuStrip = cmsMartialArts;

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

            treMartialArts.SelectedNode = objNode;

            _objFunctions.SortTree(treMartialArts);
            CalculateBP();

            _blnIsDirty = true;
            UpdateWindowTitle();
        }
开发者ID:janhelke,项目名称:chummer2,代码行数:79,代码来源:frmCreate.cs


示例9: cmdDeleteMartialArt_Click

        private void cmdDeleteMartialArt_Click(object sender, EventArgs e)
        {
            try
            {
                if (treMartialArts.SelectedNode.Level == 0)
                    return;

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

                if (treMartialArts.SelectedNode.Level == 1)
                {
                    if (treMartialArts.SelectedNode.Parent == treMartialArts.Nodes[0])
                    {
                        // Characters may only have 2 Maneuvers per Martial Art Rating (start at -2 since we're potentially removing one).
                        int intTotalRating = -2;
                        foreach (MartialArt objCharacterMartialArt in _objCharacter.MartialArts)
                            intTotalRating += objCharacterMartialArt.Rating * 2;

                        if (treMartialArts.Nodes[1].Nodes.Count > intTotalRating && !_objCharacter.IgnoreRules)
                        {
                            MessageBox.Show(LanguageManager.Instance.GetString("Message_MartialArtManeuverLimit"), LanguageManager.Instance.GetString("MessageTitle_MartialArtManeuverLimit"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return;
                        }

                        // Delete the selected Martial Art.
                        MartialArt objMartialArt = _objFunctions.FindMartialArt(treMartialArts.SelectedNode.Tag.ToString(), _objCharacter.MartialArts);

                        // Remove the Improvements for any Advantages for the Martial Art that is being removed.
                        foreach (MartialArtAdvantage objAdvantage in objMartialArt.Advantages)
                        {
                            _objImprovementManager.RemoveImprovements(Improvement.ImprovementSource.MartialArtAdvantage, objAdvantage.InternalId);
                        }

                        _objCharacter.MartialArts.Remove(objMartialArt);
                        treMartialArts.SelectedNode.Remove();
                    }
                    else
                    {
                        // Delete the selected Martial Art Maenuver.
                        MartialArtManeuver objManeuver = _objFunctions.FindMartialArtManeuver(treMartialArts.SelectedNode.Tag.ToString(), _objCharacter.MartialArtManeuvers);

                        _objCharacter.MartialArtManeuvers.Remove(objManeuver);
                        treMartialArts.SelectedNode.Remove();
                    }

                    CalculateBP();
                    UpdateCharacterInfo();

                    _blnIsDirty = true;
                    UpdateWindowTitle();
                }
                if (treMartialArts.SelectedNode.Level == 2)
                {
                    // Find the selected Advantage object.
                    MartialArt objSelectedMartialArt = new MartialArt(_objCharacter);
                    MartialArtAdvantage objSelectedAdvantage = _objFunctions.FindMartialArtAdvantage(treMartialArts.SelectedNode.Tag.ToString(), _objCharacter.MartialArts, out objSelectedMartialArt);

                    _objImprovementManager.RemoveImprovements(Improvement.ImprovementSource.MartialArtAdvantage, objSelectedAdvantage.InternalId);
                    treMartialArts.SelectedNode.Remove();

                    objSelectedMartialArt.Advantages.Remove(objSelectedAdvantage);

                    CalculateBP();
                    UpdateCharacterInfo();

                    _blnIsDirty = true;
                    UpdateWindowTitle();
                }
            }
            catch
            {
            }
        }
开发者ID:janhelke,项目名称:chummer2,代码行数:74,代码来源:frmCreate.cs


示例10: treMartialArts_AfterSelect

        private void treMartialArts_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                // The Rating NUD is only enabled if a Martial Art is currently selected.
                if (treMartialArts.SelectedNode.Level == 1 && treMartialArts.SelectedNode.Parent == treMartialArts.Nodes[0])
                {
                    MartialArt objMartialArt = _objFunctions.FindMartialArt(treMartialArts.SelectedNode.Tag.ToString(), _objCharacter.MartialArts);

                    _blnSkipRefresh = true;
                    nudMartialArtsRating.Enabled = true;
                    nudMartialArtsRating.Value = objMartialArt.Rating;
                    string strBook = _objOptions.LanguageBookShort(objMartialArt.Source);
                    string strPage = objMartialArt.Page;
                    lblMartialArtSource.Text = strBook + " " + strPage;
                    tipTooltip.SetToolTip(lblMartialArtSource, _objOptions.LanguageBookLong(objMartialArt.Source) + " page " + objMartialArt.Page);
                    _blnSkipRefresh = false;
                }
                else
                    nudMartialArtsRating.Enabled = false;

                // Display the Martial Art Advantage information.
                if (treMartialArts.SelectedNode.Level == 2)
                {
                    MartialArt objMartialArt = new MartialArt(_objCharacter);
                    MartialArtAdvantage objAdvantage = _objFunctions.FindMartialArtAdvantage(treMartialArts.SelectedNode.Tag.ToString(), _objCharacter.MartialArts, out objMartialArt);

                    string strBook = _objOptions.LanguageBookShort(objMartialArt.Source);
                    string strPage = objMartialArt.Page;
                    lblMartialArtSource.Text = strBook + " " + strPage;
                    tipTooltip.SetToolTip(lblMartialArtSource, _objOptions.LanguageBookLong(objMartialArt.Source) + " page " + objMartialArt.Page);
                }

                // Display the Maneuver information.
                if (treMartialArts.SelectedNode.Level == 1 && treMartialArts.SelectedNode.Parent == treMartialArts.Nodes[1])
                {
                    MartialArtManeuver objManeuver = _objFunctions.FindMartialArtManeuver(treMartialArts.SelectedNode.Tag.ToString(), _objCharacter.MartialArtManeuvers);

                    string strBook = _objOptions.LanguageBookShort(objManeuver.Source);
                    string strPage = objManeuver.Page;
                    lblMartialArtSource.Text = strBook + " " + strPage;
                    tipTooltip.SetToolTip(lblMartialArtSource, _objOptions.LanguageBookLong(objManeuver.Source) + " page " + objManeuver.Page);
                }
            }
            catch
            {
                nudMartialArtsRating.Enabled = false;
            }
        }
开发者ID:janhelke,项目名称:chummer2,代码行数:49,代码来源:frmCreate.cs


示例11: cmdAddMartialArt_Click

        private void cmdAddMartialArt_Click(object sender, EventArgs e)
        {
            int intKarmaCost = 7 * _objOptions.KarmaQuality;
            if (intKarmaCost > _objCharacter.Karma)
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughKarma"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughKarma"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            frmSelectMartialArt frmPickMartialArt = new frmSelectMartialArt(_objCharacter);
            frmPickMartialArt.ShowDialog(this);

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

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

            XmlNode objXmlArt = objXmlDocument.SelectSingleNode("/chummer/martialarts/martialart[name = \"" + frmPickMartialArt.SelectedMartialArt + "\"]");

            TreeNode objNode = new TreeNode();
            MartialArt objMartialArt = new MartialArt(_objCharacter);
            objMartialArt.Create(objXmlArt, objNode, _objCharacter);
            _objCharacter.MartialArts.Add(objMartialArt);

            objNode.ContextMenuStrip = cmsMartialArts;

            // Create the Expense Log Entry.
            ExpenseLogEntry objExpense = new ExpenseLogEntry();
            objExpense.Create(intKarmaCost * -1, LanguageManager.Instance.GetString("String_ExpenseLearnMartialArt") + " " + frmPickMartialArt.SelectedMartialArt, ExpenseType.Karma, DateTime.Now);
            _objCharacter.ExpenseEntries.Add(objExpense);
            _objCharacter.Karma -= intKarmaCost;

            ExpenseUndo objUndo = new ExpenseUndo();
            objUndo.CreateKarma(KarmaExpenseType.AddMartialArt, objMartialArt.Name);
            objExpense.Undo = objUndo;

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

            treMartialArts.SelectedNode = objNode;

            _objFunctions.SortTree(treMartialArts);
            UpdateCharacterInfo();

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


示例12: treMartialArts_AfterSelect

        private void treMartialArts_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                // The Rating NUD is only enabled if a Martial Art is currently selected.
                if (treMartialArts.SelectedNode.Level == 1 && treMartialArts.SelectedNode.Parent == treMartialArts.Nodes[0])
                {
                    MartialArt objMartialArt = _objFunctions.FindMartialArt(treMartialArts.SelectedNode.Tag.ToString(), _objCharacter.MartialArts);

                    _blnSkipRefresh = true;
                    if (objMartialArt.Rating < 4)
                    {
                        string strTip = LanguageManager.Instance.GetString("Tip_ImproveItem").Replace("{0}", (objMartialArt.Rating + 1).ToString()).Replace("{1}", (((objMartialArt.Rating + 1) * 5 * _objOptions.KarmaQuality) - ((objMartialArt.Rating) * 5 * _objOptions.KarmaQuality)).ToString());
                        tipTooltip.SetToolTip(cmdImproveMartialArtsRating, strTip);
                        cmdImproveMartialArtsRating.Enabled = true;
                    }
                    else
                        cmdImproveMartialArtsRating.Enabled = false;
                    lblMartialArtsRating.Text = objMartialArt.Rating.ToString();
                    string strBook = _objOptions.LanguageBookShort(objMartialArt.Source);
                    string strPage = objMartialArt.Page;
                    lblMartialArtSource.Text = strBook + " " + strPage;
                    tipTooltip.SetToolTip(lblMartialArtSource, _objOptions.LanguageBookLong(objMartialArt.Source) + " " + LanguageManager.Instance.GetString("String_Page") + " " + objMartialArt.Page);
                    _blnSkipRefresh = false;
                }
                else
                    cmdImproveMartialArtsRating.Enabled = false;

                // Display the Martial Art Advantage information.
                if (treMartialArts.SelectedNode.Level == 2)
                {
                    MartialArt objMartialArt = new MartialArt(_objCharacter);
                    MartialArtAdvantage objAdvantage = _objFunctions.FindMartialArtAdvantage(treMartialArts.SelectedNode.Tag.ToString(), _objCharacter.MartialArts, out objMartialArt);

                    string strBook = _objOptions.LanguageBookShort(objMartialArt.Source);
                    string strPage = objMartialArt.Page;
                    lblMartialArtSource.Text = strBook + " " + strPage;
                    tipTooltip.SetToolTip(lblMartialArtSource, _objOptions.LanguageBookLong(objMartialArt.Source) + " page " + objMartialArt.Page);
                }

                // Display the Maneuver information.
                if (treMartialArts.SelectedNode.Level == 1 && treMartialArts.SelectedNode.Parent == treMartialArts.Nodes[1])
                {
                    MartialArtManeuver objManeuver = _objFunctions.FindMartialArtManeuver(treMartialArts.SelectedNode.Tag.ToString(), _objCharacter.MartialArtManeuvers);

                    string strBook = _objOptions.LanguageBookShort(objManeuver.Source);
                    string strPage = objManeuver.Page;
                    lblMartialArtSource.Text = strBook + " " + strPage;
                    tipTooltip.SetToolTip(lblMartialArtSource, _objOptions.LanguageBookLong(objManeuver.Source) + " page " + objManeuver.Page);
                }
            }
            catch
            {
                cmdImproveMartialArtsRating.Enabled = false;
            }
        }
开发者ID:Nebual,项目名称:chummer,代码行数:56,代码来源:frmCareer.cs


示例13: Load


//.........这里部分代码省略.........
            }

            // Powers.
            objXmlNodeList = objXmlDocument.SelectNodes("/character/powers/power");
            foreach (XmlNode objXmlPower in objXmlNodeList)
            {
                Power objPower = new Power(this);
                objPower.Load(objXmlPower);
                _lstPowers.Add(objPower);
            }

            // Spirits/Sprites.
            objXmlNodeList = objXmlDocument.SelectNodes("/character/spirits/spirit");
            foreach (XmlNode objXmlSpirit in objXmlNodeList)
            {
                Spirit objSpirit = new Spirit(this);
                objSpirit.Load(objXmlSpirit);
                _lstSpirits.Add(objSpirit);
            }

            // Compex Forms/Technomancer Programs.
            objXmlNodeList = objXmlDocument.SelectNodes("/character/techprograms/techprogram");
            foreach (XmlNode objXmlProgram in objXmlNodeList)
            {
                TechProgram objProgram = new TechProgram(this);
                objProgram.Load(objXmlProgram);
                _lstTechPrograms.Add(objProgram);
            }

            // Martial Arts.
            objXmlNodeList = objXmlDocument.SelectNodes("/character/martialarts/martialart");
            foreach (XmlNode objXmlArt in objXmlNodeList)
            {
                MartialArt objMartialArt = new MartialArt(this);
                objMartialArt.Load(objXmlArt);
                _lstMartialArts.Add(objMartialArt);
            }

            // Martial Art Maneuvers.
            objXmlNodeList = objXmlDocument.SelectNodes("/character/martialartmaneuvers/martialartmaneuver");
            foreach (XmlNode objXmlManeuver in objXmlNodeList)
            {
                MartialArtManeuver objManeuver = new MartialArtManeuver(this);
                objManeuver.Load(objXmlManeuver);
                _lstMartialArtManeuvers.Add(objManeuver);
            }

            // Lifestyles.
            objXmlNodeList = objXmlDocument.SelectNodes("/character/lifestyles/lifestyle");
            foreach (XmlNode objXmlLifestyle in objXmlNodeList)
            {
                Lifestyle objLifestyle = new Lifestyle(this);
                objLifestyle.Load(objXmlLifestyle);
                _lstLifestyles.Add(objLifestyle);
            }

            // <gears>
            objXmlNodeList = objXmlDocument.SelectNodes("/character/gears/gear");
            foreach (XmlNode objXmlGear in objXmlNodeList)
            {
                switch (objXmlGear["category"].InnerText)
                {
                    case "Commlink":
                    case "Commlink Upgrade":
                        Commlink objCommlink = new Commlink(this);
                        objCommlink.Load(objXmlGear);
开发者ID:Nebual,项目名称:chummer,代码行数:67,代码来源:clsCharacter.cs


示例14: CreateImprovements


//.........这里部分代码省略.........
                            if (objXmlSkill["applytorating"] != null)
                            {
                                if (objXmlSkill["applytorating"].InnerText == "yes")
                                    blnAddToRating = true;
                            }

                            string strUseUnique = strUnique;
                            if (nodBonus["specificskill"].Attributes["precedence"] != null)
                                strUseUnique = "precedence" + nodBonus["specificskill"].Attributes["precedence"].InnerText;

                            // Record the improvement.
                            if (objXmlSkill["bonus"] != null)
                            {
                                objFunctions.LogWrite(CommonFunctions.LogType.Message, "Chummer.ImprovementManager", "Calling CreateImprovement for bonus");
                                CreateImprovement(objXmlSkill["name"].InnerText, objImprovementSource, strSourceName, Improvement.ImprovementType.Skill, strUseUnique, ValueToInt(objXmlSkill["bonus"].InnerXml, intRating), 1, 0, 0, 0, 0, "", blnAddToRating);
                            }
                            if (objXmlSkill["max"] != null)
                            {
                                objFunctions.LogWrite(CommonFunctions.LogType.Message, "Chummer.ImprovementManager", "Calling CreateImprovement for max");
                                CreateImprovement(objXmlSkill["name"].InnerText, objImprovementSource, strSourceName, Improvement.ImprovementType.Skill, strUseUnique, 0, 1, 0, ValueToInt(objXmlSkill["max"].InnerText, intRating), 0, 0, "", blnAddToRating);
                            }
                        }
                    }

                    // The Improvement adds a martial art
                    if (NodeExists(nodBonus, "martialart"))
                    {
                        objFunctions.LogWrite(CommonFunctions.LogType.Message, "Chummer.ImprovementManager", "martialart");
                        objFunctions.LogWrite(CommonFunctions.LogType.Content, "Chummer.ImprovementManager", "martialart = " + nodBonus["martialart"].OuterXml.ToString());
                        XmlDocument _objXmlDocument = XmlManager.Instance.Load("martialarts.xml");
                        XmlNode objXmlArt = _objXmlDocument.SelectSingleNode("/chummer/martialarts/martialart[name = \"" + nodBonus["martialart"].InnerText + "\"]");

                        TreeNode objNode = new TreeNode();
                        MartialArt objMartialArt = new MartialArt(_objCharacter);
                        objMartialArt.Create(objXmlArt, objNode, _objCharacter);
                        objMartialArt.IsQuality = true;
                        _objCharacter.MartialArts.Add(objMartialArt);
                    }

                    // The Improvement adds a limit modifier
                    if (NodeExists(nodBonus, "limitmodifier"))
                    {
                        objFunctions.LogWrite(CommonFunctions.LogType.Message, "Chummer.ImprovementManager", "limitmodifier");
                        objFunctions.LogWrite(CommonFunctions.LogType.Content, "Chummer.ImprovementManager", "limitmodifier = " + nodBonus["limitmodifier"].OuterXml.ToString());
                        LimitModifier objLimitMod = new LimitModifier(_objCharacter);
                        string strLimit = nodBonus["limitmodifier"]["limit"].InnerText;
                        string strBonus = nodBonus["limitmodifier"]["value"].InnerText;
                        string strCondition = "";
                        try
                        {
                            strCondition = nodBonus["limitmodifier"]["condition"].InnerText;
                        }
                        catch { }
                        int intBonus = 0;
                        if (strBonus == "Rating")
                            intBonus = intRating;
                        else
                            intBonus = Convert.ToInt32(strBonus);
                        string strName = strFriendlyName;
                        TreeNode nodTemp = new TreeNode();
                        objFunctions.LogWrite(CommonFunctions.LogType.Message, "Chummer.ImprovementManager", "Calling CreateImprovement");
                        CreateImprovement(strLimit, objImprovementSource, strSourceName, Improvement.ImprovementType.LimitModifier, strFriendlyName, intBonus, 0, 0, 0, 0, 0, strCondition);

                    }

                    // The Improvement adjusts a Skill Category.
开发者ID:kingcortez905,项目名称:chummer5,代码行数:67,代码来源:clsImprovement.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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