本文整理汇总了C#中Chummer.PowerControl类的典型用法代码示例。如果您正苦于以下问题:C# PowerControl类的具体用法?C# PowerControl怎么用?C# PowerControl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PowerControl类属于Chummer命名空间,在下文中一共展示了PowerControl类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AddPACKSKit
//.........这里部分代码省略.........
// Check for Advantages.
foreach (XmlNode objXmlAdvantage in objXmlArt.SelectNodes("techniques/technique"))
{
TreeNode objChildNode = new TreeNode();
MartialArtAdvantage objAdvantage = new MartialArtAdvantage(_objCharacter);
XmlNode objXmlAdvantageNode = objXmlMartialArtDocument.SelectSingleNode("/chummer/martialarts/martialart[name = \"" + objXmlArt["name"].InnerText + "\"]/techniques/technique[. = \"" + objXmlAdvantage.InnerText + "\"]");
objAdvantage.Create(objXmlAdvantageNode, _objCharacter, objChildNode);
objArt.Advantages.Add(objAdvantage);
objNode.Nodes.Add(objChildNode);
objNode.Expand();
}
treMartialArts.Nodes[0].Nodes.Add(objNode);
treMartialArts.Nodes[0].Expand();
}
}
// Update Adept Powers.
if (objXmlKit["powers"] != null)
{
// Open the Powers XML file and locate the selected power.
XmlDocument objXmlPowerDocument = XmlManager.Instance.Load("powers.xml");
foreach (XmlNode objXmlPower in objXmlKit.SelectNodes("powers/power"))
{
XmlNode objXmlPowerNode = objXmlPowerDocument.SelectSingleNode("/chummer/powers/power[name = \"" + objXmlPower["name"].InnerText + "\"]");
int i = panPowers.Controls.Count;
Power objPower = new Power(_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;
objPowerControl.PowerName = objXmlPowerNode["name"].InnerText;
objPowerControl.PointsPerLevel = Convert.ToDecimal(objXmlPowerNode["points"].InnerText, GlobalOptions.Instance.CultureInfo);
objPowerControl.AdeptWayDiscount = Convert.ToDecimal(objXmlPowerNode["adeptway"].InnerText, GlobalOptions.Instance.CultureInfo);
if (objXmlPowerNode["levels"].InnerText == "no")
{
objPowerControl.LevelEnabled = false;
}
else
{
objPowerControl.LevelEnabled = true;
if (objXmlPowerNode["levels"].InnerText != "yes")
objPower.MaxLevels = Convert.ToInt32(objXmlPowerNode["levels"].InnerText);
}
objPower.Source = objXmlPowerNode["source"].InnerText;
objPower.Page = objXmlPowerNode["page"].InnerText;
if (objXmlPowerNode["doublecost"] != null)
objPower.DoubleCost = false;
if (objXmlPowerNode.InnerXml.Contains("bonus"))
{
objPower.Bonus = objXmlPowerNode["bonus"];
if (objXmlPower["name"].Attributes["select"] != null)
_objImprovementManager.ForcedValue = objXmlPower["name"].Attributes["select"].InnerText;
开发者ID:cormanater,项目名称:chummer5a,代码行数:66,代码来源:frmCreate.cs
示例2: 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;
Power objPower = new Power(_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;
objPowerControl.PowerName = frmPickPower.SelectedPower;
objPowerControl.PointsPerLevel = frmPickPower.PointsPerLevel;
objPowerControl.AdeptWayDiscount = frmPickPower.AdeptWayDiscount;
objPowerControl.LevelEnabled = frmPickPower.LevelEnabled;
if (frmPickPower.MaxLevels() > 0)
if (objPower.Name == "Improved Ability (skill)")
{
foreach (Skill objSkill in _objCharacter.Skills)
{
if (objPower.Extra == objSkill.Name || (objSkill.ExoticSkill && objPower.Extra == (objSkill.DisplayName + " (" + objSkill.Specialization + ")")))
{
int intImprovedAbilityMaximum = objSkill.Rating + (objSkill.Rating / 2);
if (intImprovedAbilityMaximum == 0)
{
intImprovedAbilityMaximum = 1;
}
objPower.MaxLevels = intImprovedAbilityMaximum;
}
}
}
else
{
objPowerControl.MaxLevels = frmPickPower.MaxLevels();
}
// Open the Cyberware XML file and locate the selected piece.
XmlDocument objXmlDocument = XmlManager.Instance.Load("powers.xml");
XmlNode objXmlPower = objXmlDocument.SelectSingleNode("/chummer/powers/power[name = \"" + frmPickPower.SelectedPower + "\"]");
objPower.Source = objXmlPower["source"].InnerText;
objPower.Page = objXmlPower["page"].InnerText;
if (objXmlPower["doublecost"] != null)
objPower.DoubleCost = false;
if (objXmlPower.InnerXml.Contains("bonus"))
{
objPower.Bonus = objXmlPower["bonus"];
if (!_objImprovementManager.CreateImprovements(Improvement.ImprovementSource.Power, objPower.InternalId, objPower.Bonus, false, Convert.ToInt32(objPower.Rating), objPower.DisplayNameShort))
{
_objCharacter.Powers.Remove(objPower);
return;
}
objPowerControl.Extra = _objImprovementManager.SelectedValue;
}
// 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);
}
开发者ID:cormanater,项目名称:chummer5a,代码行数:81,代码来源:frmCreate.cs
示例3: frmCreate_Load
//.........这里部分代码省略.........
foreach (Armor objArmor in _objCharacter.Armor)
{
_objFunctions.CreateArmorTreeNode(objArmor, treArmor, cmsArmor, cmsArmorMod, cmsArmorGear);
}
// Populate Weapons.
// Start by populating Locations.
foreach (string strLocation in _objCharacter.WeaponLocations)
{
TreeNode objLocation = new TreeNode();
objLocation.Tag = strLocation;
objLocation.Text = strLocation;
objLocation.ContextMenuStrip = cmsWeaponLocation;
treWeapons.Nodes.Add(objLocation);
}
foreach (Weapon objWeapon in _objCharacter.Weapons)
{
_objFunctions.CreateWeaponTreeNode(objWeapon, treWeapons.Nodes[0], cmsWeapon, cmsWeaponMod, cmsWeaponAccessory, cmsWeaponAccessoryGear);
}
PopulateCyberwareList();
// Populate Spell list.
foreach (Spell objSpell in _objCharacter.Spells)
{
treSpells.Add(objSpell, cmsSpell, _objCharacter);
}
// Populate Adept Powers.
i = -1;
foreach (Power objPower in _objCharacter.Powers)
{
i++;
PowerControl objPowerControl = new PowerControl();
objPowerControl.PowerObject = objPower;
// Attach an EventHandler for the PowerRatingChanged Event.
objPowerControl.PowerRatingChanged += objPower_PowerRatingChanged;
objPowerControl.DeletePower += objPower_DeletePower;
objPowerControl.PowerName = objPower.Name;
objPowerControl.Extra = objPower.Extra;
objPowerControl.PointsPerLevel = objPower.PointsPerLevel;
objPowerControl.AdeptWayDiscount = objPower.AdeptWayDiscount;
objPowerControl.LevelEnabled = objPower.LevelsEnabled;
if (objPower.MaxLevels > 0)
{
if (objPower.Name == "Improved Ability (skill)")
{
foreach (Skill objSkill in _objCharacter.Skills)
if (objPower.Extra == objSkill.Name || (objSkill.ExoticSkill && objPower.Extra == (objSkill.DisplayName + " (" + objSkill.Specialization + ")")))
{
int intImprovedAbilityMaximum = objSkill.Rating + (objSkill.Rating / 2);
if (intImprovedAbilityMaximum == 0)
{
intImprovedAbilityMaximum = 1;
}
objPower.MaxLevels = intImprovedAbilityMaximum;
}
else
{
objPowerControl.MaxLevels = objPower.MaxLevels;
}
}
else
{
开发者ID:cormanater,项目名称:chummer5a,代码行数:67,代码来源:frmCreate.cs
示例4: RefreshPowers
public void RefreshPowers()
{
_blnLoading = true;
foreach (PowerControl pc in panPowers.Controls)
{
pc.PowerRatingChanged += objPower_PowerRatingChanged;
pc.DeletePower += objPower_DeletePower;
}
// Remove Adept Powers.
panPowers.Controls.Clear();
// Populate Adept Powers.
int i = -1;
foreach (Power objPower in _objCharacter.Powers)
{
i++;
PowerControl objPowerControl = new PowerControl();
objPowerControl.PowerObject = objPower;
// Attach an EventHandler for the PowerRatingChanged Event.
objPowerControl.PowerRatingChanged += objPower_PowerRatingChanged;
objPowerControl.DeletePower += objPower_DeletePower;
objPowerControl.PowerName = objPower.Name;
objPowerControl.Extra = objPower.Extra;
objPowerControl.PointsPerLevel = objPower.PointsPerLevel;
objPowerControl.AdeptWayDiscount = objPower.AdeptWayDiscount;
objPowerControl.LevelEnabled = objPower.LevelsEnabled;
if (objPower.MaxLevels > 0)
objPowerControl.MaxLevels = objPower.MaxLevels;
objPowerControl.RefreshMaximum(_objCharacter.MAG.TotalValue);
if (objPower.Rating < 1)
objPower.Rating = 1;
objPowerControl.PowerLevel = Convert.ToInt32(objPower.Rating);
if (objPower.DiscountedAdeptWay)
objPowerControl.DiscountedByAdeptWay = true;
if (objPower.DiscountedGeas)
objPowerControl.DiscountedByGeas = true;
objPowerControl.Top = i * objPowerControl.Height;
panPowers.Controls.Add(objPowerControl);
}
_blnLoading = false;
}
开发者ID:cormanater,项目名称:chummer5a,代码行数:46,代码来源:frmCreate.cs
示例5: frmCreate_Load
//.........这里部分代码省略.........
objNode.ForeColor = Color.SaddleBrown;
objNode.ToolTipText = objSpell.Notes;
switch (objSpell.Category)
{
case "Combat":
treSpells.Nodes[0].Nodes.Add(objNode);
treSpells.Nodes[0].Expand();
break;
case "Detection":
treSpells.Nodes[1].Nodes.Add(objNode);
treSpells.Nodes[1].Expand();
break;
case "Health":
treSpells.Nodes[2].Nodes.Add(objNode);
treSpells.Nodes[2].Expand();
break;
case "Illusion":
treSpells.Nodes[3].Nodes.Add(objNode);
treSpells.Nodes[3].Expand();
break;
case "Manipulation":
treSpells.Nodes[4].Nodes.Add(objNode);
treSpells.Nodes[4].Expand();
break;
}
}
// Populate Adept Powers.
i = -1;
foreach (Power objPower in _objCharacter.Powers)
{
i++;
PowerControl objPowerControl = new PowerControl();
objPowerControl.PowerObject = objPower;
// Attach an EventHandler for the PowerRatingChanged Event.
objPowerControl.PowerRatingChanged += objPower_PowerRatingChanged;
objPowerControl.DeletePower += objPower_DeletePower;
objPowerControl.RefreshMaximum(_objCharacter.MAG.TotalValue);
if (objPower.Rating < 1)
objPower.Rating = 1;
objPowerControl.PowerLevel = Convert.ToInt32(objPower.Rating);
if (objPower.DiscountedAdeptWay)
objPowerControl.DiscountedByAdeptWay = true;
if (objPower.DiscountedGeas)
objPowerControl.DiscountedByGeas = true;
objPowerControl.Top = i * objPowerControl.Height;
panPowers.Controls.Add(objPowerControl);
}
// Populate Magician Spirits.
i = -1;
foreach (Spirit objSpirit in _objCharacter.Spirits)
{
if (objSpirit.EntityType == SpiritType.Spirit)
{
i++;
SpiritControl objSpiritControl = new SpiritControl();
objSpiritControl.SpiritObject = objSpirit;
// Attach an EventHandler for the ServicesOwedChanged Event.
objSpiritControl.ServicesOwedChanged += objSpirit_ServicesOwedChanged;
objSpiritControl.ForceChanged += objSpirit_ForceChanged;
开发者ID:janhelke,项目名称:chummer2,代码行数:67,代码来源:frmCreate.cs
示例6: 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);
}
开发者ID:janhelke,项目名称:chummer2,代码行数:46,代码来源:frmCreate.cs
示例7: frmCareer_Load
//.........这里部分代码省略.........
treSpells.Nodes[1].Expand();
break;
case "Health":
treSpells.Nodes[2].Nodes.Add(objNode);
treSpells.Nodes[2].Expand();
break;
case "Illusion":
treSpells.Nodes[3].Nodes.Add(objNode);
treSpells.Nodes[3].Expand();
break;
case "Manipulation":
treSpells.Nodes[4].Nodes.Add(objNode);
treSpells.Nodes[4].Expand();
break;
case "Rituals":
int intNode = 5;
if (_objCharacter.AdeptEnabled && !_objCharacter.MagicianEnabled)
intNode = 0;
treSpells.Nodes[intNode].Nodes.Add(objNode);
treSpells.Nodes[intNode].Expand();
break;
case "Enchantments":
treSpells.Nodes[6].Nodes.Add(objNode);
treSpells.Nodes[6].Expand();
break;
}
}
// Populate Adept Powers.
i = -1;
foreach (Power objPower in _objCharacter.Powers)
{
i++;
PowerControl objPowerControl = new PowerControl();
objPowerControl.PowerObject = objPower;
// Attach an EventHandler for the PowerRatingChanged Event.
objPowerControl.PowerRatingChanged += objPower_PowerRatingChanged;
objPowerControl.DeletePower += objPower_DeletePower;
objPowerControl.PowerName = objPower.Name;
objPowerControl.Extra = objPower.Extra;
objPowerControl.PointsPerLevel = objPower.PointsPerLevel;
objPowerControl.AdeptWayDiscount = objPower.AdeptWayDiscount;
objPowerControl.LevelEnabled = objPower.LevelsEnabled;
if (objPower.MaxLevels > 0)
objPowerControl.MaxLevels = objPower.MaxLevels;
objPowerControl.RefreshMaximum(_objCharacter.MAG.TotalValue);
if (objPower.Rating < 1)
objPower.Rating = 1;
objPowerControl.PowerLevel = Convert.ToInt32(objPower.Rating);
if (objPower.DiscountedAdeptWay)
objPowerControl.DiscountedByAdeptWay = true;
if (objPower.DiscountedGeas)
objPowerControl.DiscountedByGeas = true;
objPowerControl.Top = i * objPowerControl.Height;
panPowers.Controls.Add(objPowerControl);
}
// Populate Magician Spirits.
i = -1;
foreach (Spirit objSpirit in _objCharacter.Spirits)
{
if (objSpirit.EntityType == SpiritType.Spirit)
{
开发者ID:Althalusdlg,项目名称:chummer5a,代码行数:67,代码来源:frmCareer.cs
示例8: RefreshPowers
public void RefreshPowers()
{
_blnLoading = true;
foreach (PowerControl pc in panPowers.Controls)
{
pc.PowerRatingChanged += objPower_PowerRatingChanged;
pc.DeletePower += objPower_DeletePower;
}
// Remove Adept Powers.
panPowers.Controls.Clear();
// Populate Adept Powers.
int i = -1;
foreach (Power objPower in _objCharacter.Powers)
{
i++;
PowerControl objPowerControl = new PowerControl();
objPowerControl.PowerObject = objPower;
// Attach an EventHandler for the PowerRatingChanged Event.
objPowerControl.PowerRatingChanged += objPower_PowerRatingChanged;
objPowerControl.DeletePower += objPower_DeletePower;
objPowerControl.PowerName = objPower.Name;
objPowerControl.Extra = objPower.Extra;
objPowerControl.PointsPerLevel = objPower.PointsPerLevel;
objPowerControl.AdeptWayDiscount = objPower.AdeptWayDiscount;
objPowerControl.LevelEnabled = objPower.LevelsEnabled;
if (objPower.MaxLevels > 0)
{
if (objPower.Name == "Improved Ability (skill)")
{
foreach (Skill objSkill in _objCharacter.SkillsSection.Skills)
if (objPower.Extra == objSkill.Name || (objSkill.IsExoticSkill && objPower.Extra == (objSkill.DisplayName + " (" + (objSkill as ExoticSkill).Specific + ")")))
{
int intImprovedAbilityMaximum = objSkill.Rating + (objSkill.Rating / 2);
if (intImprovedAbilityMaximum == 0)
{
intImprovedAbilityMaximum = 1;
}
objPower.MaxLevels = intImprovedAbilityMaximum;
}
else
{
objPowerControl.MaxLevels = objPower.MaxLevels;
}
}
else
{
objPowerControl.MaxLevels = objPower.MaxLevels;
}
}
objPowerControl.RefreshMaximum(_objCharacter.MAG.TotalValue);
if (objPower.Rating < 1)
objPower.Rating = 1;
objPowerControl.PowerLevel = Convert.ToInt32(objPower.Rating);
if (objPower.DiscountedAdeptWay)
objPowerControl.DiscountedByAdeptWay = true;
if (objPower.DiscountedGeas)
objPowerControl.DiscountedByGeas = true;
objPowerControl.Top = i * objPowerControl.Height;
panPowers.Controls.Add(objPowerControl);
}
_blnLoading = false;
}
开发者ID:argo2445,项目名称:chummer5a,代码行数:68,代码来源:frmCreate.cs
示例9: frmCreate_Load
//.........这里部分代码省略.........
foreach (Armor objArmor in _objCharacter.Armor)
{
_objFunctions.CreateArmorTreeNode(objArmor, treArmor, cmsArmor, cmsArmorMod, cmsArmorGear);
}
// Populate Weapons.
// Start by populating Locations.
foreach (string strLocation in _objCharacter.WeaponLocations)
{
TreeNode objLocation = new TreeNode();
objLocation.Tag = strLocation;
objLocation.Text = strLocation;
objLocation.ContextMenuStrip = cmsWeaponLocation;
treWeapons.Nodes.Add(objLocation);
}
foreach (Weapon objWeapon in _objCharacter.Weapons)
{
_objFunctions.CreateWeaponTreeNode(objWeapon, treWeapons.Nodes[0], cmsWeapon, cmsWeaponAccessory, cmsWeaponAccessoryGear);
}
PopulateCyberwareList();
// Populate Spell list.
foreach (Spell objSpell in _objCharacter.Spells)
{
treSpells.Add(objSpell, cmsSpell, _objCharacter);
}
// Populate Adept Powers.
i = -1;
foreach (Power objPower in _objCharacter.Powers)
{
i++;
PowerControl objPowerControl = new PowerControl();
objPowerControl.PowerObject = objPower;
// Attach an EventHandler for the PowerRatingChanged Event.
objPowerControl.PowerRatingChanged += objPower_PowerRatingChanged;
objPowerControl.DeletePower += objPower_DeletePower;
objPowerControl.PowerName = objPower.Name;
objPowerControl.Extra = objPower.Extra;
objPowerControl.PointsPerLevel = objPower.PointsPerLevel;
objPowerControl.AdeptWayDiscount = objPower.AdeptWayDiscount;
objPowerControl.LevelEnabled = objPower.LevelsEnabled;
if (objPower.MaxLevels > 0)
{
if (objPower.Name == "Improved Ability (skill)")
{
foreach (Skill objSkill in _objCharacter.SkillsSection.Skills)
if (objPower.Extra == objSkill.Name || (objSkill.IsExoticSkill && objPower.Extra == (objSkill.DisplayName + " (" + (objSkill as ExoticSkill).Specific + ")")))
{
int intImprovedAbilityMaximum = objSkill.Rating + (objSkill.Rating / 2);
if (intImprovedAbilityMaximum == 0)
{
intImprovedAbilityMaximum = 1;
}
objPower.MaxLevels = intImprovedAbilityMaximum;
}
else
{
objPowerControl.MaxLevels = objPower.MaxLevels;
}
}
else
{
开发者ID:argo2445,项目名称:chummer5a,代码行数:67,代码来源:frmCreate.cs
注:本文中的Chummer.PowerControl类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论