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


C# Skill.Load方法代码示例

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


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

示例1: Load

		/// <summary>
		/// Load the Attribute from the XmlNode.
		/// </summary>
		/// <param name="objNode">XmlNode to load.</param>
		public void Load(XmlNode objNode)
		{
			string strId;
			if (objNode.TryGetField("id", out strId))
			{
				Id = Guid.Parse(strId);
			}
			_strName = objNode["name"].InnerText;
			_strSkillGroup = objNode["skillgroup"].InnerText;
			_strSkillCategory = objNode["skillcategory"].InnerText;
			_blnIsGrouped = Convert.ToBoolean(objNode["grouped"].InnerText);
            _blnDefault = Convert.ToBoolean(objNode["default"].InnerText);
			_intRating = Convert.ToInt32(objNode["rating"].InnerText);
			bool basefail = false;
            try
            {
                _intBase = Convert.ToInt32(objNode["base"].InnerText);
            }
            catch
            {
                _intBase = _intRating;
	            basefail = true;
            }
            try
            {
                _intKarma = Convert.ToInt32(objNode["karma"].InnerText);
            }
            catch
            {
                _intKarma = 0;
            }

			if (!basefail)
			{
				if (_intRating != _intKarma + _intBase)
				{
					_intBase = _intRating - _intKarma;
				}
			}

            _intFreeLevels = Convert.ToInt32(objNode["freelevels"].InnerText);
            _intRatingMaximum = Convert.ToInt32(objNode["ratingmax"].InnerText);
			_blnKnowledgeSkill = Convert.ToBoolean(objNode["knowledge"].InnerText);
			try
			{
				_blnExoticSkill = Convert.ToBoolean(objNode["exotic"].InnerText);
			}
			catch
			{
			}
            try
            {
                _blnBuyWithKarma = Convert.ToBoolean(objNode["buywithkarma"].InnerText);
            }
            catch
            {
            }
            if (objNode["spec"].InnerText.Contains("Hold-Outs"))
				objNode["spec"].InnerText = "Holdouts";
			_strSkillSpec = objNode["spec"].InnerText;

            if (_strSkillSpec != "")
            {
                SkillSpecialization objSpec = new SkillSpecialization(_strSkillSpec);
                _lstSpecializations.Add(objSpec);
                _strSkillSpec = "";
            }

			_blnAllowDelete = Convert.ToBoolean(objNode["allowdelete"].InnerText);
			_strAttribute = objNode["attribute"].InnerText;
            if (objNode.InnerXml.Contains("skillspecializations"))
            {
                XmlNodeList nodSpecializations = objNode.SelectNodes("skillspecializations/skillspecialization");
                foreach (XmlNode nodSpecialization in nodSpecializations)
                {
                    SkillSpecialization objSpec = new SkillSpecialization("");
                    objSpec.Load(nodSpecialization);
                    _lstSpecializations.Add(objSpec);
                }
            }
            try
			{
				_strSource = objNode["source"].InnerText;
				_strPage = objNode["page"].InnerText;
			}
			catch
			{
			}

			if (objNode["folded"] != null)
			{
				foreach (XmlNode foldNode in objNode["folded"].ChildNodes)
				{
					Skill s = new Skill(_objCharacter);
					s.Load(foldNode);

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

示例2: Load

        /// <summary>
        /// Load the Character from an XML file.
        /// </summary>
        public bool Load()
        {
            XmlDocument objXmlDocument = new XmlDocument();
            objXmlDocument.Load(_strFileName);

            XmlNode objXmlCharacter = objXmlDocument.SelectSingleNode("/character");
            XmlNodeList objXmlNodeList;

            try
            {
                _blnIgnoreRules = Convert.ToBoolean(objXmlCharacter["ignorerules"].InnerText);
            }
            catch
            {
                _blnIgnoreRules = false;
            }
            try
            {
                _blnCreated = Convert.ToBoolean(objXmlCharacter["created"].InnerText);
            }
            catch
            {
            }

            ResetCharacter();

            // Get the game edition of the file if possible and make sure it's intended to be used with this version of the application.
            try
            {
                if (objXmlCharacter["gameedition"].InnerText != string.Empty && objXmlCharacter["gameedition"].InnerText != "SR5")
                {
                    MessageBox.Show(LanguageManager.Instance.GetString("Message_IncorrectGameVersion_SR4"), LanguageManager.Instance.GetString("MessageTitle_IncorrectGameVersion"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return false;
                }
            }
            catch
            {
            }

            // Get the name of the settings file in use if possible.
            try
            {
                _strSettingsFileName = objXmlCharacter["settings"].InnerText;
            }
            catch
            {
            }

            // Load the character's settings file.
            if (!_objOptions.Load(_strSettingsFileName))
                return false;

            try
            {
                _decEssenceAtSpecialStart = Convert.ToDecimal(objXmlCharacter["essenceatspecialstart"].InnerText, GlobalOptions.Instance.CultureInfo);
                // fix to work around a mistake made when saving decimal values in previous versions.
                if (_decEssenceAtSpecialStart > EssenceMaximum)
                    _decEssenceAtSpecialStart /= 10;
            }
            catch
            {
            }

            try
            {
                _strVersionCreated = objXmlCharacter["createdversion"].InnerText;
            }
            catch
            {
            }

            // Metatype information.
            _strMetatype = objXmlCharacter["metatype"].InnerText;
            try
            {
                _strWalk = objXmlCharacter["walk"].InnerText;
                _strRun = objXmlCharacter["run"].InnerText;
                _strSprint = objXmlCharacter["sprint"].InnerText;
            }
            catch
            {
            }
            _intMetatypeBP = Convert.ToInt32(objXmlCharacter["metatypebp"].InnerText);
            _strMetavariant = objXmlCharacter["metavariant"].InnerText;
            try
            {
                _strMetatypeCategory = objXmlCharacter["metatypecategory"].InnerText;
            }
            catch
            {
            }
            try
            {
                _intMutantCritterBaseSkills = Convert.ToInt32(objXmlCharacter["mutantcritterbaseskills"].InnerText);
            }
            catch
            {
//.........这里部分代码省略.........
开发者ID:ercflemng,项目名称:chummer5a,代码行数:101,代码来源:clsCharacter.cs

示例3: Load

        /// <summary>
        /// Load the Character from an XML file.
        /// </summary>
        public bool Load()
        {
            XmlDocument objXmlDocument = new XmlDocument();
            objXmlDocument.Load(_strFileName);

            XmlNode objXmlCharacter = objXmlDocument.SelectSingleNode("/character");
            XmlNodeList objXmlNodeList;

            try
            {
                _blnIgnoreRules = Convert.ToBoolean(objXmlCharacter["ignorerules"].InnerText);
            }
            catch
            {
                _blnIgnoreRules = false;
            }
            try
            {
                _blnCreated = Convert.ToBoolean(objXmlCharacter["created"].InnerText);
            }
            catch
            {
            }

            ResetCharacter();

            // Get the game edition of the file if possible and make sure it's intended to be used with this version of the application.
            try
            {
                if (objXmlCharacter["gameedition"].InnerText != string.Empty && objXmlCharacter["gameedition"].InnerText != "SR4")
                {
                    MessageBox.Show(LanguageManager.Instance.GetString("Message_IncorrectGameVersion_SR5"), LanguageManager.Instance.GetString("MessageTitle_IncorrectGameVersion"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return false;
                }
            }
            catch
            {
            }

            // Get the name of the settings file in use if possible.
            try
            {
                _strSettingsFileName = objXmlCharacter["settings"].InnerText;
            }
            catch
            {
            }

            // Load the character's settings file.
            if (!_objOptions.Load(_strSettingsFileName))
                return false;

            try
            {
                _decEssenceAtSpecialStart = Convert.ToDecimal(objXmlCharacter["essenceatspecialstart"].InnerText, GlobalOptions.Instance.CultureInfo);
                // fix to work around a mistake made when saving decimal values in previous versions.
                if (_decEssenceAtSpecialStart > EssenceMaximum)
                    _decEssenceAtSpecialStart /= 10;
            }
            catch
            {
            }

            // Metatype information.
            _strMetatype = objXmlCharacter["metatype"].InnerText;
            try
            {
                _strMovement = objXmlCharacter["movement"].InnerText;
            }
            catch
            {
            }
            _intMetatypeBP = Convert.ToInt32(objXmlCharacter["metatypebp"].InnerText);
            _strMetavariant = objXmlCharacter["metavariant"].InnerText;
            try
            {
                _strMetatypeCategory = objXmlCharacter["metatypecategory"].InnerText;
            }
            catch
            {
            }
            try
            {
                _intMutantCritterBaseSkills = Convert.ToInt32(objXmlCharacter["mutantcritterbaseskills"].InnerText);
            }
            catch
            {
            }

            // General character information.
            _strName = objXmlCharacter["name"].InnerText;
            try
            {
                _strMugshot = objXmlCharacter["mugshot"].InnerText;
            }
            catch
            {
//.........这里部分代码省略.........
开发者ID:Nebual,项目名称:chummer,代码行数:101,代码来源:clsCharacter.cs


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