本文整理汇总了C#中Weapon.Load方法的典型用法代码示例。如果您正苦于以下问题:C# Weapon.Load方法的具体用法?C# Weapon.Load怎么用?C# Weapon.Load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Weapon
的用法示例。
在下文中一共展示了Weapon.Load方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: mnuEditPaste_Click
private void mnuEditPaste_Click(object sender, EventArgs e)
{
if (tabCharacterTabs.SelectedTab == tabStreetGear)
{
// Lifestyle Tab.
if (tabStreetGearTabs.SelectedTab == tabLifestyle)
{
// Paste Lifestyle.
Lifestyle objLifestyle = new Lifestyle(_objCharacter);
XmlNode objXmlNode = GlobalOptions.Instance.Clipboard.SelectSingleNode("/character/lifestyle");
if (objXmlNode != null)
{
objLifestyle.Load(objXmlNode, true);
// Reset the number of months back to 1 since 0 isn't valid in Create Mode.
objLifestyle.Months = 1;
_objCharacter.Lifestyles.Add(objLifestyle);
TreeNode objLifestyleNode = new TreeNode();
objLifestyleNode.Text = objLifestyle.DisplayName;
objLifestyleNode.Tag = objLifestyle.InternalId;
if (objLifestyle.StyleType.ToString() != "Standard")
objLifestyleNode.ContextMenuStrip = cmsAdvancedLifestyle;
else
objLifestyleNode.ContextMenuStrip = cmsLifestyleNotes;
if (objLifestyle.Notes != string.Empty)
objLifestyleNode.ForeColor = Color.SaddleBrown;
objLifestyleNode.ToolTipText = CommonFunctions.WordWrap(objLifestyle.Notes, 100);
treLifestyles.Nodes[0].Nodes.Add(objLifestyleNode);
UpdateCharacterInfo();
_blnIsDirty = true;
UpdateWindowTitle();
return;
}
}
// Armor Tab.
if (tabStreetGearTabs.SelectedTab == tabArmor)
{
// Paste Armor.
Armor objArmor = new Armor(_objCharacter);
XmlNode objXmlNode = GlobalOptions.Instance.Clipboard.SelectSingleNode("/character/armor");
if (objXmlNode != null)
{
objArmor.Load(objXmlNode, true);
_objCharacter.Armor.Add(objArmor);
_objFunctions.CreateArmorTreeNode(objArmor, treArmor, cmsArmor, cmsArmorMod, cmsArmorGear);
UpdateCharacterInfo();
_blnIsDirty = true;
UpdateWindowTitle();
return;
}
// Paste Gear.
Gear objGear = new Gear(_objCharacter);
objXmlNode = GlobalOptions.Instance.Clipboard.SelectSingleNode("/character/gear");
if (objXmlNode != null)
{
switch (objXmlNode["category"].InnerText)
{
case "Commlinks":
case "Cyberdecks":
case "Rigger Command Consoles":
Commlink objCommlink = new Commlink(_objCharacter);
objCommlink.Load(objXmlNode, true);
objGear = objCommlink;
break;
default:
Gear objNewGear = new Gear(_objCharacter);
objNewGear.Load(objXmlNode, true);
objGear = objNewGear;
break;
}
foreach (Armor objCharacterArmor in _objCharacter.Armor)
{
if (objCharacterArmor.InternalId == treArmor.SelectedNode.Tag.ToString())
{
objCharacterArmor.Gear.Add(objGear);
TreeNode objNode = new TreeNode();
objNode.Text = objGear.DisplayName;
objNode.Tag = objGear.InternalId;
objNode.ContextMenuStrip = cmsArmorGear;
_objFunctions.BuildGearTree(objGear, objNode, cmsArmorGear);
treArmor.SelectedNode.Nodes.Add(objNode);
treArmor.SelectedNode.Expand();
}
}
// Add any Weapons that come with the Gear.
objXmlNode = GlobalOptions.Instance.Clipboard.SelectSingleNode("/character/weapon");
if (objXmlNode != null)
{
//.........这里部分代码省略.........
示例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
{
//.........这里部分代码省略.........
示例3: Load
/// <summary>
/// Load the Vehicle from the XmlNode.
/// </summary>
/// <param name="objNode">XmlNode to load.</param>
public void Load(XmlNode objNode, bool blnCopy = false)
{
_guiID = Guid.Parse(objNode["guid"].InnerText);
_strName = objNode["name"].InnerText;
_strCategory = objNode["category"].InnerText;
//Some vehicles have different Offroad Handling speeds. If so, we want to split this up for use with mods and such later.
if (objNode["handling"].InnerText.Contains('/'))
{
_intHandling = Convert.ToInt32(objNode["handling"].InnerText.Split('/')[0]);
_intOffroadHandling = Convert.ToInt32(objNode["handling"].InnerText.Split('/')[1]);
}
else
{
_intHandling = Convert.ToInt32(objNode["handling"].InnerText);
if (objNode.InnerXml.Contains("offroadhandling"))
{
_intOffroadHandling = Convert.ToInt32(objNode["offroadhandling"].InnerText);
}
}
_intAccel = Convert.ToInt32(objNode["accel"].InnerText);
objNode.TryGetField("seats", out _intSeats);
_intSpeed = Convert.ToInt32(objNode["speed"].InnerText);
_intPilot = Convert.ToInt32(objNode["pilot"].InnerText);
_intBody = Convert.ToInt32(objNode["body"].InnerText);
_intArmor = Convert.ToInt32(objNode["armor"].InnerText);
_intSensor = Convert.ToInt32(objNode["sensor"].InnerText);
objNode.TryGetField("devicerating", out _intDeviceRating);
_strAvail = objNode["avail"].InnerText;
_strCost = objNode["cost"].InnerText;
objNode.TryGetField("addslots", out _intAddSlots);
objNode.TryGetField("modslots", out _intModSlots);
_strSource = objNode["source"].InnerText;
objNode.TryGetField("page", out _strPage);
objNode.TryGetField("matrixcmfilled", out _intMatrixCMFilled);
objNode.TryGetField("physicalcmfilled", out _intPhysicalCMFilled);
objNode.TryGetField("vehiclename", out _strVehicleName);
objNode.TryGetField("homenode", out _blnHomeNode);
if (GlobalOptions.Instance.Language != "en-us")
{
XmlDocument objXmlDocument = XmlManager.Instance.Load("vehicles.xml");
XmlNode objVehicleNode = objXmlDocument.SelectSingleNode("/chummer/vehicles/vehicle[name = \"" + _strName + "\"]");
if (objVehicleNode != null)
{
if (objVehicleNode["translate"] != null)
_strAltName = objVehicleNode["translate"].InnerText;
if (objVehicleNode["altpage"] != null)
_strAltPage = objVehicleNode["altpage"].InnerText;
}
objVehicleNode = objXmlDocument.SelectSingleNode("/chummer/categories/category[. = \"" + _strCategory + "\"]");
if (objVehicleNode != null)
{
if (objVehicleNode.Attributes["translate"] != null)
_strAltCategory = objVehicleNode.Attributes["translate"].InnerText;
}
}
if (objNode.InnerXml.Contains("<mods>"))
{
XmlNodeList nodChildren = objNode.SelectNodes("mods/mod");
foreach (XmlNode nodChild in nodChildren)
{
VehicleMod objMod = new VehicleMod(_objCharacter);
objMod.Load(nodChild, blnCopy);
_lstVehicleMods.Add(objMod);
}
}
if (objNode.InnerXml.Contains("<gears>"))
{
XmlNodeList nodChildren = objNode.SelectNodes("gears/gear");
foreach (XmlNode nodChild in nodChildren)
{
switch (nodChild["category"].InnerText)
{
case "Commlinks":
case "Commlink Accessories":
case "Cyberdecks":
case "Rigger Command Consoles":
Commlink objCommlink = new Commlink(_objCharacter);
objCommlink.Load(nodChild, blnCopy);
_lstGear.Add(objCommlink);
break;
default:
Gear objGear = new Gear(_objCharacter);
objGear.Load(nodChild, blnCopy);
_lstGear.Add(objGear);
break;
}
}
}
if (objNode.InnerXml.Contains("<weapons>"))
{
XmlNodeList nodChildren = objNode.SelectNodes("weapons/weapon");
//.........这里部分代码省略.........
示例4: 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
{
//.........这里部分代码省略.........
示例5: Load
/// <summary>
/// Load the VehicleMod from the XmlNode.
/// </summary>
/// <param name="objNode">XmlNode to load.</param>
public void Load(XmlNode objNode, bool blnCopy = false)
{
_guiID = Guid.Parse(objNode["guid"].InnerText);
_strName = objNode["name"].InnerText;
_strCategory = objNode["category"].InnerText;
_strLimit = objNode["limit"].InnerText;
_strSlots = objNode["slots"].InnerText;
_intRating = Convert.ToInt32(objNode["rating"].InnerText);
_strMaxRating = objNode["maxrating"].InnerText;
objNode.TryGetField("weaponmountcategories", out _strWeaponMountCategories);
objNode.TryGetField("response", out _intResponse);
objNode.TryGetField("system", out _intSystem);
objNode.TryGetField("firewall", out _intFirewall);
objNode.TryGetField("signal", out _intSignal);
objNode.TryGetField("pilot", out _intPilot);
objNode.TryGetField("page", out _strPage);
_strAvail = objNode["avail"].InnerText;
_strCost = objNode["cost"].InnerText;
_strSource = objNode["source"].InnerText;
_blnIncludeInVehicle = Convert.ToBoolean(objNode["included"].InnerText);
objNode.TryGetField("installed", out _blnInstalled);
objNode.TryGetField("subsystems", out _strSubsystems);
if (objNode.InnerXml.Contains("<weapons>"))
{
XmlNodeList nodChildren = objNode.SelectNodes("weapons/weapon");
foreach (XmlNode nodChild in nodChildren)
{
Weapon objWeapon = new Weapon(_objCharacter);
objWeapon.Load(nodChild, blnCopy);
_lstVehicleWeapons.Add(objWeapon);
}
}
if (objNode.InnerXml.Contains("<cyberwares>"))
{
XmlNodeList nodChildren = objNode.SelectNodes("cyberwares/cyberware");
foreach (XmlNode nodChild in nodChildren)
{
Cyberware objCyberware = new Cyberware(_objCharacter);
objCyberware.Load(nodChild, blnCopy);
_lstCyberware.Add(objCyberware);
}
}
try
{
_nodBonus = objNode["bonus"];
}
catch
{
}
objNode.TryGetField("notes", out _strNotes);
objNode.TryGetField("discountedcost", out _blnDiscountCost);
objNode.TryGetField("extra", out _strExtra);
if (GlobalOptions.Instance.Language != "en-us")
{
XmlDocument objXmlDocument = XmlManager.Instance.Load("vehicles.xml");
XmlNode objModNode = objXmlDocument.SelectSingleNode("/chummer/mods/mod[name = \"" + _strName + "\"]");
if (objModNode != null)
{
if (objModNode["translate"] != null)
_strAltName = objModNode["translate"].InnerText;
if (objModNode["altpage"] != null)
_strAltPage = objModNode["altpage"].InnerText;
}
objModNode = objXmlDocument.SelectSingleNode("/chummer/categories/category[. = \"" + _strCategory + "\"]");
if (objModNode != null)
{
if (objModNode.Attributes["translate"] != null)
_strAltCategory = objModNode.Attributes["translate"].InnerText;
}
}
if (blnCopy)
{
_guiID = Guid.NewGuid();
}
}