本文整理汇总了C#中Chummer.Power.Create方法的典型用法代码示例。如果您正苦于以下问题:C# Power.Create方法的具体用法?C# Power.Create怎么用?C# Power.Create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Chummer.Power
的用法示例。
在下文中一共展示了Power.Create方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: cmdAddPower_Click
private void cmdAddPower_Click(object sender, EventArgs e)
{
frmSelectPower frmPickPower = new frmSelectPower(_objCharacter);
frmPickPower.ShowDialog(this);
// Make sure the dialogue window was not canceled.
if (frmPickPower.DialogResult == DialogResult.Cancel)
return;
int i = panPowers.Controls.Count;
// Open the Cyberware XML file and locate the selected piece.
XmlDocument objXmlDocument = XmlManager.Instance.Load("powers.xml");
XmlNode objXmlPower = objXmlDocument.SelectSingleNode("/chummer/powers/power[id = \"" + frmPickPower.SelectedPower + "\"]");
Power objPower = new Power(_objCharacter);
objPower.Create(objXmlPower, _objCharacter);
_objCharacter.Powers.Add(objPower);
PowerControl objPowerControl = new PowerControl();
objPowerControl.PowerObject = objPower;
// Attach an EventHandler for the PowerRatingChanged Event.
objPowerControl.PowerRatingChanged += objPower_PowerRatingChanged;
objPowerControl.DeletePower += objPower_DeletePower;
objPower.Source = objXmlPower["source"].InnerText;
objPower.Page = objXmlPower["page"].InnerText;
if (objXmlPower["doublecost"] != null)
objPower.DoubleCost = false;
// Set the control's Maximum.
objPowerControl.RefreshMaximum(_objCharacter.MAG.TotalValue);
objPowerControl.Top = i * objPowerControl.Height;
objPowerControl.RefreshTooltip();
panPowers.Controls.Add(objPowerControl);
UpdateCharacterInfo();
_blnIsDirty = true;
UpdateWindowTitle();
if (frmPickPower.AddAgain)
cmdAddPower_Click(sender, e);
}
示例2: CreateAllPowersTest
public void CreateAllPowersTest()
{
// Create a new Human character.
Character objCharacter = new Character();
objCharacter.LoadMetatype(Guid.Parse("e28e7075-f635-4c02-937c-e4fc61c51602"));
XmlDocument objXmlDocument = XmlManager.Instance.Load("powers.xml");
foreach (XmlNode objXmlNode in objXmlDocument.SelectNodes("/chummer/powers/power"))
{
Power objPower = new Power(objCharacter);
objPower.Create(objXmlNode, objCharacter, 1, "", false);
}
}