本文整理汇总了C#中Gear.Load方法的典型用法代码示例。如果您正苦于以下问题:C# Gear.Load方法的具体用法?C# Gear.Load怎么用?C# Gear.Load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gear
的用法示例。
在下文中一共展示了Gear.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: RefreshPasteStatus
//.........这里部分代码省略.........
catch
{
}
try
{
Armor objArmor = new Armor(_objCharacter);
Gear objGear = _objFunctions.FindArmorGear(treArmor.SelectedNode.Tag.ToString(), _objCharacter.Armor, out objArmor);
if (objGear != null)
blnCopyEnabled = true;
}
catch
{
}
}
// Weapons Tab.
if (tabStreetGearTabs.SelectedTab == tabWeapons)
{
if (GlobalOptions.Instance.ClipboardContentType == ClipboardContentType.Weapon)
blnPasteEnabled = true;
if (GlobalOptions.Instance.ClipboardContentType == ClipboardContentType.Gear || GlobalOptions.Instance.ClipboardContentType == ClipboardContentType.Commlink || GlobalOptions.Instance.ClipboardContentType == ClipboardContentType.OperatingSystem)
{
// Check if the copied Gear can be pasted into the selected Weapon Accessory.
Gear objGear = new Gear(_objCharacter);
XmlNode 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;
}
objGear.Parent = null;
// Make sure that a Weapon Accessory is selected and that it allows Gear of the item's Category.
WeaponAccessory objAccessory = new WeaponAccessory(_objCharacter);
try
{
foreach (Weapon objCharacterWeapon in _objCharacter.Weapons)
{
foreach (WeaponAccessory objWeaponAccessory in objCharacterWeapon.WeaponAccessories)
{
if (objWeaponAccessory.InternalId == treWeapons.SelectedNode.Tag.ToString())
{
objAccessory = objWeaponAccessory;
break;
}
}
}
if (objAccessory.AllowGear != null)
{
foreach (XmlNode objAllowed in objAccessory.AllowGear.SelectNodes("gearcategory"))
{
if (objAllowed.InnerText == objGear.Category)
{
示例3: Load
/// <summary>
/// Load the Stacked Focus from the XmlNode.
/// </summary>
/// <param name="objNode">XmlNode to load.</param>
public void Load(XmlNode objNode)
{
_guiID = Guid.Parse(objNode["guid"].InnerText);
_guiGearId = Guid.Parse(objNode["gearid"].InnerText);
_blnBonded = Convert.ToBoolean(objNode["bonded"].InnerText);
XmlNodeList nodGears = objNode.SelectNodes("gears/gear");
foreach (XmlNode nodGear in nodGears)
{
Gear objGear = new Gear(_objCharacter);
objGear.Load(nodGear);
_lstGear.Add(objGear);
}
}
示例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 != "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
{
//.........这里部分代码省略.........
示例5: 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
{
//.........这里部分代码省略.........