本文整理汇总了C#中Chummer.SkillControl类的典型用法代码示例。如果您正苦于以下问题:C# SkillControl类的具体用法?C# SkillControl怎么用?C# SkillControl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SkillControl类属于Chummer命名空间,在下文中一共展示了SkillControl类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: cmdAddExoticSkill_Click
private void cmdAddExoticSkill_Click(object sender, EventArgs e)
{
frmSelectExoticSkill frmPickExoticSkill = new frmSelectExoticSkill();
frmPickExoticSkill.ShowDialog(this);
if (frmPickExoticSkill.DialogResult == DialogResult.Cancel)
return;
XmlDocument objXmlDocument = XmlManager.Instance.Load("skills.xml");
XmlNode nodSkill = objXmlDocument.SelectSingleNode("/chummer/skills/skill[name = \"" + frmPickExoticSkill.SelectedExoticSkill + "\"]");
int i = panActiveSkills.Controls.Count;
Skill objSkill = new Skill(_objCharacter);
objSkill.Attribute = nodSkill["attribute"].InnerText;
objSkill.Specialization = frmPickExoticSkill.SelectedExoticSkillSpecialisation;
if (_objCharacter.MaxSkillRating > 0)
objSkill.RatingMaximum = _objCharacter.MaxSkillRating;
SkillControl objSkillControl = new SkillControl(_objCharacter);
objSkillControl.SkillObject = objSkill;
objSkillControl.Width = 510;
// Attach an EventHandler for the RatingChanged and SpecializationChanged Events.
objSkillControl.RatingChanged += objActiveSkill_RatingChanged;
objSkillControl.SpecializationChanged += objSkill_SpecializationChanged;
objSkillControl.SkillName = frmPickExoticSkill.SelectedExoticSkill;
objSkillControl.BuyWithKarmaChanged += objActiveSkill_BuyWithKarmaChanged;
objSkillControl.SkillSpec = frmPickExoticSkill.SelectedExoticSkillSpecialisation;
objSkillControl.SkillCategory = nodSkill["category"].InnerText;
if (nodSkill["default"].InnerText == "Yes")
objSkill.Default = true;
else
objSkill.Default = false;
objSkill.ExoticSkill = true;
_objCharacter.Skills.Add(objSkill);
// Populate the Skill's Specializations (if any).
foreach (XmlNode objXmlSpecialization in nodSkill.SelectNodes("specs/spec"))
{
if (objXmlSpecialization.Attributes["translate"] != null)
objSkillControl.AddSpec(objXmlSpecialization.Attributes["translate"].InnerText);
else
objSkillControl.AddSpec(objXmlSpecialization.InnerText);
}
// Look through the Weapons file and grab the names of items that are part of the appropriate Exotic Category or use the matching Exoctic Skill.
XmlDocument objXmlWeaponDocument = XmlManager.Instance.Load("weapons.xml");
XmlNodeList objXmlWeaponList = objXmlWeaponDocument.SelectNodes("/chummer/weapons/weapon[category = \"" + frmPickExoticSkill.SelectedExoticSkill + "s\" or useskill = \"" + frmPickExoticSkill.SelectedExoticSkill + "\"]");
foreach (XmlNode objXmlWeapon in objXmlWeaponList)
{
if (objXmlWeapon["translate"] != null)
objSkillControl.AddSpec(objXmlWeapon["translate"].InnerText);
else
objSkillControl.AddSpec(objXmlWeapon["name"].InnerText);
}
if (_objCharacter.IgnoreRules)
{
objSkillControl.SkillRatingMaximum = 12;
}
else
{
objSkillControl.SkillRatingMaximum = 6;
}
// Set the SkillControl's Location since scrolling the Panel causes it to actually change the child Controls' Locations.
objSkillControl.Location = new Point(0, objSkillControl.Height * i + panActiveSkills.AutoScrollPosition.Y);
panActiveSkills.Controls.Add(objSkillControl);
_blnIsDirty = true;
UpdateWindowTitle();
}
示例2: AddPACKSKit
//.........这里部分代码省略.........
case "int":
nudINT.Value = Convert.ToInt32(objXmlAttribute.InnerText) - (6 - _objCharacter.INT.MetatypeMaximum);
break;
case "log":
nudLOG.Value = Convert.ToInt32(objXmlAttribute.InnerText) - (6 - _objCharacter.LOG.MetatypeMaximum);
break;
case "wil":
nudWIL.Value = Convert.ToInt32(objXmlAttribute.InnerText) - (6 - _objCharacter.WIL.MetatypeMaximum);
break;
case "mag":
nudMAG.Value = Convert.ToInt32(objXmlAttribute.InnerText) - (6 - _objCharacter.MAG.MetatypeMaximum);
break;
case "res":
nudRES.Value = Convert.ToInt32(objXmlAttribute.InnerText) - (6 - _objCharacter.RES.MetatypeMaximum);
break;
default:
nudEDG.Value = Convert.ToInt32(objXmlAttribute.InnerText) - (6 - _objCharacter.EDG.MetatypeMaximum);
break;
}
}
}
// Update Skills.
if (objXmlKit["skills"] != null)
{
// Active Skills.
foreach (XmlNode objXmlSkill in objXmlKit.SelectNodes("skills/skill"))
{
if (objXmlSkill["name"].InnerText.Contains("Exotic"))
{
int i = panActiveSkills.Controls.Count;
Skill objSkill = new Skill(_objCharacter);
SkillControl objSkillControl = new SkillControl(_objCharacter);
objSkillControl.SkillObject = objSkill;
objSkillControl.Width = 510;
// Attach an EventHandler for the RatingChanged and SpecializationChanged Events.
objSkillControl.RatingChanged += objActiveSkill_RatingChanged;
objSkillControl.SpecializationChanged += objSkill_SpecializationChanged;
objSkillControl.SkillName = objXmlSkill["name"].InnerText;
switch (objXmlSkill["name"].InnerText)
{
case "Exotic Ranged Weapon":
case "Exotic Melee Weapon":
objSkill.Attribute = "AGI";
objSkillControl.SkillCategory = "Combat Active";
objSkill.Default = true;
break;
default:
objSkill.Attribute = "REA";
objSkillControl.SkillCategory = "Vehicle Active";
objSkill.Default = false;
break;
}
objSkill.ExoticSkill = true;
_objCharacter.Skills.Add(objSkill);
if (_objCharacter.IgnoreRules)
{
objSkillControl.SkillRatingMaximum = 12;
}
else
{
示例3: cmdAddKnowledgeSkill_Click
private void cmdAddKnowledgeSkill_Click(object sender, EventArgs e)
{
int i = panKnowledgeSkills.Controls.Count;
Skill objSkill = new Skill(_objCharacter);
objSkill.Attribute = "LOG";
objSkill.SkillCategory = "Academic";
if (_objCharacter.MaxSkillRating > 0)
objSkill.RatingMaximum = _objCharacter.MaxSkillRating;
SkillControl objSkillControl = new SkillControl(_objCharacter);
objSkillControl.SkillObject = objSkill;
// Attach an EventHandler for the RatingChanged and SpecializationChanged Events.
objSkillControl.RatingChanged += objKnowledgeSkill_RatingChanged;
objSkillControl.SpecializationChanged += objSkill_SpecializationChanged;
objSkillControl.DeleteSkill += objKnowledgeSkill_DeleteSkill;
objSkillControl.BuyWithKarmaChanged += objKnowledgeSkill_BuyWithKarmaChanged;
objSkillControl.MergeClicked += knoSkill_MergeClick;
objSkillControl.KnowledgeSkill = true;
objSkillControl.AllowDelete = true;
if (_objCharacter.IgnoreRules)
{
objSkillControl.SkillRatingMaximum = 12;
}
else
{
objSkillControl.SkillRatingMaximum = 6;
}
// Set the SkillControl's Location since scrolling the Panel causes it to actually change the child Controls' Locations.
objSkillControl.Location = new Point(0, objSkillControl.Height * i + panKnowledgeSkills.AutoScrollPosition.Y);
panKnowledgeSkills.Controls.Add(objSkillControl);
_objCharacter.Skills.Add(objSkill);
_blnIsDirty = true;
UpdateWindowTitle();
}
示例4: frmCreate_Load
//.........这里部分代码省略.........
if (_objCharacter.BuildMethod == CharacterBuildMethod.SumtoTen || _objCharacter.BuildMethod == CharacterBuildMethod.Priority)
{
nudNuyen.Maximum = _objCharacter.MaxNuyen;
}
else if (_objCharacter.BuildMethod == CharacterBuildMethod.Karma || _objCharacter.BuildMethod == CharacterBuildMethod.LifeModule)
{
nudNuyen.Maximum = 200;
}
}
else
{
//nudNuyen.Maximum = decimal.MaxValue;
}
if (_objCharacter.BornRich) nudNuyen.Maximum += 30;
nudNuyen.Value = _objCharacter.NuyenBP;
// Load the Skills information.
objXmlDocument = XmlManager.Instance.Load("skills.xml");
// Populate the Skills Controls.
XmlNodeList objXmlNodeList = objXmlDocument.SelectNodes("/chummer/skills/skill[" + _objCharacter.Options.BookXPath() + "]");
// Counter to keep track of the number of Controls that have been added to the Panel so we can determine their vertical positioning.
int i = -1;
if (_objCharacter.BuildMethod == CharacterBuildMethod.Karma)
{
label8.Visible = false;
label14.Visible = false;
}
foreach (Skill objSkill in _objCharacter.Skills)
{
if (!objSkill.KnowledgeSkill && !objSkill.ExoticSkill)
{
i++;
SkillControl objSkillControl = new SkillControl(_objCharacter);
objSkillControl.SkillObject = objSkill;
// Attach an EventHandler for the RatingChanged and SpecializationChanged Events.
objSkillControl.RatingChanged += objActiveSkill_RatingChanged;
objSkillControl.BuyWithKarmaChanged += objActiveSkill_BuyWithKarmaChanged;
objSkillControl.SpecializationChanged += objSkill_SpecializationChanged;
objSkillControl.BreakGroupClicked += objSkill_BreakGroupClicked;
objSkillControl.SkillName = objSkill.Name;
objSkillControl.SkillCategory = objSkill.SkillCategory;
objSkillControl.SkillGroup = objSkill.SkillGroup;
objSkillControl.SkillRatingMaximum = objSkill.RatingMaximum;
objSkillControl.SkillRating = objSkill.Rating;
objSkillControl.SkillBase = objSkill.Base;
objSkillControl.SkillKarma = objSkill.Karma;
objSkillControl.SkillSpec = objSkill.Specialization;
XmlNode objXmlSkill = objXmlDocument.SelectSingleNode("/chummer/skills/skill[name = \"" + objSkill.Name + "\"]");
// Populate the Skill's Specializations (if any).
foreach (XmlNode objXmlSpecialization in objXmlSkill.SelectNodes("specs/spec"))
{
if (objXmlSpecialization.Attributes["translate"] != null)
objSkillControl.AddSpec(objXmlSpecialization.Attributes["translate"].InnerText);
else
objSkillControl.AddSpec(objXmlSpecialization.InnerText);
}
// Set the control's vertical position and add it to the Skills Panel.
objSkillControl.Top = i * objSkillControl.Height;
objSkillControl.Width = 510;
objSkillControl.AutoScroll = false;
panActiveSkills.Controls.Add(objSkillControl);
示例5: RefreshKnowledgeSkills
/// <summary>
/// Refresh knowledge skills to the ones having an internal Skill
/// </summary>
public void RefreshKnowledgeSkills()
{
List<SkillControl> knowledgeSkillControls = new List<SkillControl>();
foreach (Control control in panKnowledgeSkills.Controls)
{
SkillControl sc = (SkillControl) control;
if(sc != null) knowledgeSkillControls.Add(sc);
}
List<Skill> knowledgeSkills = new List<Skill>(
from skill in _objCharacter.Skills
where skill.KnowledgeSkill == true
select skill);
//O(N^2) but with N < 25, won't matter much
//Find skills that don't exist in skillcontrols
foreach (Skill skill in knowledgeSkills)
{
bool blnFound = false;
foreach (SkillControl control in knowledgeSkillControls)
{
if (control.SkillObject == skill)
{
blnFound = true;
control.SkillBase = skill.Base;
}
}
if (!blnFound)
{
SkillControl nControl = new SkillControl(_objCharacter);
nControl.SkillObject = skill;
knowledgeSkillControls.Add(nControl);
nControl.RatingChanged += objKnowledgeSkill_RatingChanged;
nControl.SpecializationChanged += objSkill_SpecializationChanged;
nControl.DeleteSkill += objKnowledgeSkill_DeleteSkill;
nControl.BreakGroupClicked += objSkill_BreakGroupClicked;
nControl.BuyWithKarmaChanged += objKnowledgeSkill_BuyWithKarmaChanged;
nControl.MergeClicked += knoSkill_MergeClick;
nControl.AllowDelete = skill.AllowDelete;
nControl.SkillRatingMaximum = skill.RatingMaximum;
nControl.KnowledgeSkill = skill.KnowledgeSkill;
nControl.SkillBase = skill.Base;
nControl.SkillKarma = skill.Karma;
nControl.SkillRating = skill.Rating;
nControl.SkillName = skill.Name;
nControl.SkillSpec = skill.Specialization;
nControl.LockKnowledge = skill.LockKnowledge;
nControl.AutoScroll = false;
panKnowledgeSkills.Controls.Add(nControl);
}
}
//find skillcontrols that don't exist in skills
foreach (SkillControl control in knowledgeSkillControls)
{
bool blnFound = false;
foreach (Skill skill in knowledgeSkills)
{
if (control.SkillObject == skill)
{
blnFound = true;
break;
}
}
if (!blnFound)
{
control.RatingChanged -= objKnowledgeSkill_RatingChanged;
control.SpecializationChanged -= objSkill_SpecializationChanged;
control.DeleteSkill -= objKnowledgeSkill_DeleteSkill;
control.BreakGroupClicked -= objSkill_BreakGroupClicked;
control.BuyWithKarmaChanged -= objKnowledgeSkill_BuyWithKarmaChanged;
control.MergeClicked -= knoSkill_MergeClick;
panKnowledgeSkills.Controls.Remove(control);
}
}
for (int i = 0; i < panKnowledgeSkills.Controls.Count; i++)
{
panKnowledgeSkills.Controls[i].Top = i*panKnowledgeSkills.Controls[0].Height;
}
}
示例6: frmCreate_Load
//.........这里部分代码省略.........
{
nudMysticAdeptMAGMagician.Maximum = _objCharacter.MAG.TotalValue;
nudMysticAdeptMAGMagician.Value = _objCharacter.MAGMagician;
lblMysticAdeptMAGAdept.Text = _objCharacter.MAGAdept.ToString();
lblMysticAdeptAssignment.Visible = true;
lblMysticAdeptAssignmentAdept.Visible = true;
lblMysticAdeptAssignmentMagician.Visible = true;
lblMysticAdeptMAGAdept.Visible = true;
nudMysticAdeptMAGMagician.Visible = true;
}
// Nuyen can be affected by Qualities, so adjust the total amount available to the character.
if (!_objCharacter.IgnoreRules)
nudNuyen.Maximum = _objCharacter.NuyenMaximumBP;
else
nudNuyen.Maximum = 100000;
// Nuyen.
nudNuyen.Value = _objCharacter.NuyenBP;
// Load the Skills information.
objXmlDocument = XmlManager.Instance.Load("skills.xml");
// Populate the Skills Controls.
XmlNodeList objXmlNodeList = objXmlDocument.SelectNodes("/chummer/skills/skill[" + _objCharacter.Options.BookXPath() + "]");
// Counter to keep track of the number of Controls that have been added to the Panel so we can determine their vertical positioning.
int i = -1;
foreach (Skill objSkill in _objCharacter.Skills)
{
if (!objSkill.KnowledgeSkill && !objSkill.ExoticSkill)
{
i++;
SkillControl objSkillControl = new SkillControl();
objSkillControl.SkillObject = objSkill;
// Attach an EventHandler for the RatingChanged and SpecializationChanged Events.
objSkillControl.RatingChanged += objActiveSkill_RatingChanged;
objSkillControl.SpecializationChanged += objSkill_SpecializationChanged;
objSkillControl.BreakGroupClicked += objSkill_BreakGroupClicked;
objSkillControl.SkillName = objSkill.Name;
objSkillControl.SkillCategory = objSkill.SkillCategory;
objSkillControl.SkillGroup = objSkill.SkillGroup;
objSkillControl.SkillRatingMaximum = objSkill.RatingMaximum;
objSkillControl.SkillRating = objSkill.Rating;
objSkillControl.SkillSpec = objSkill.Specialization;
XmlNode objXmlSkill = objXmlDocument.SelectSingleNode("/chummer/skills/skill[name = \"" + objSkill.Name + "\"]");
// Populate the Skill's Specializations (if any).
foreach (XmlNode objXmlSpecialization in objXmlSkill.SelectNodes("specs/spec"))
{
if (objXmlSpecialization.Attributes["translate"] != null)
objSkillControl.AddSpec(objXmlSpecialization.Attributes["translate"].InnerText);
else
objSkillControl.AddSpec(objXmlSpecialization.InnerText);
}
// Set the control's vertical position and add it to the Skills Panel.
objSkillControl.Top = i * objSkillControl.Height;
objSkillControl.Width = 510;
objSkillControl.AutoScroll = false;
panActiveSkills.Controls.Add(objSkillControl);
}
}
示例7: UpdateCharacterInfo
//.........这里部分代码省略.........
lblCHA.Text = _objCharacter.CHA.Value.ToString();
lblINT.Text = _objCharacter.INT.Value.ToString();
lblLOG.Text = _objCharacter.LOG.Value.ToString();
lblWIL.Text = _objCharacter.WIL.Value.ToString();
lblEDG.Text = _objCharacter.EDG.Value.ToString();
if (_objCharacter.MAG.Value - intEssenceLoss < 0)
lblMAG.Text = "0";
else
lblMAG.Text = (_objCharacter.MAG.Value - intEssenceLoss).ToString();
if (_objCharacter.RES.Value - intEssenceLoss < 0)
lblRES.Text = "0";
else
lblRES.Text = (_objCharacter.RES.Value - intEssenceLoss).ToString();
// If the Attribute reaches 0, the character has burned out.
if (_objCharacter.MAG.Value - intEssenceLoss < 1 && _objCharacter.MAGEnabled)
{
_objCharacter.MAG.Value = 0;
_objCharacter.MAG.MetatypeMinimum = 0;
_objCharacter.MAG.MetatypeMaximum = 0;
_objCharacter.MAG.MetatypeAugmentedMaximum = 0;
if (_objCharacter.MAGEnabled)
{
// Move all MAG-linked Active Skills to Knowledge Skills.
List<Skill> lstNewSkills = new List<Skill>();
foreach (Skill objSkill in _objCharacter.Skills)
{
if (objSkill.Attribute == "MAG" && objSkill.Rating > 0)
{
int i = panKnowledgeSkills.Controls.Count;
Skill objKnowledge = new Skill(_objCharacter);
SkillControl objSkillControl = new SkillControl();
objKnowledge.Name = objSkill.Name;
objSkillControl.SkillObject = objKnowledge;
// Attach an EventHandler for the RatingChanged and SpecializationChanged Events.
objSkillControl.RatingChanged += objKnowledgeSkill_RatingChanged;
objSkillControl.SpecializationChanged += objSkill_SpecializationChanged;
objSkillControl.DeleteSkill += objKnowledgeSkill_DeleteSkill;
objSkillControl.SkillKarmaClicked += objKnowledgeSkill_KarmaClicked;
objSkillControl.DiceRollerClicked += objSkill_DiceRollerClicked;
objSkillControl.KnowledgeSkill = true;
objSkillControl.AllowDelete = true;
if (objSkill.Rating > 13)
objSkillControl.SkillRatingMaximum = objSkill.Rating;
else
objSkillControl.SkillRatingMaximum = 12;
objSkillControl.SkillRating = objSkill.Rating;
objSkillControl.SkillCategory = "Professional";
// Set the SkillControl's Location since scrolling the Panel causes it to actually change the child Controls' Locations.
objSkillControl.Location = new Point(0, objSkillControl.Height * i + panKnowledgeSkills.AutoScrollPosition.Y);
panKnowledgeSkills.Controls.Add(objSkillControl);
lstNewSkills.Add(objKnowledge);
}
}
foreach (Skill objSkill in lstNewSkills)
_objCharacter.Skills.Add(objSkill);
}
_objCharacter.MAGEnabled = false;
_objCharacter.MagicianEnabled = false;
_objCharacter.AdeptEnabled = false;
示例8: frmCareer_Load
//.........这里部分代码省略.........
cboStream.DisplayMember = "Name";
cboStream.DataSource = lstStreams;
// Load the Metatype information before going anywhere else. Doing this later causes the Attributes to get messed up because of calls
// to UpdateCharacterInformation();
MetatypeSelected();
// If the character is a Mystic Adept, set the values for the Mystic Adept NUD.
int intCharacterMAG = _objCharacter.MAG.TotalValue;
if (_objCharacter.AdeptEnabled && _objCharacter.MagicianEnabled)
{
lblMysticAdeptMAGAdept.Text = _objCharacter.MAGAdept.ToString();
intCharacterMAG = _objCharacter.MAGMagician;
lblMysticAdeptAssignment.Visible = true;
lblMysticAdeptMAGAdept.Visible = true;
// cmdIncreasePowerPoints.Visible = true;
}
// Load the Skills information.
objXmlDocument = XmlManager.Instance.Load("skills.xml");
List<ListItem> lstComplexFormSkills = new List<ListItem>();
// Populate the Skills Controls.
XmlNodeList objXmlNodeList = objXmlDocument.SelectNodes("/chummer/skills/skill[" + _objCharacter.Options.BookXPath() + "]");
// Counter to keep track of the number of Controls that have been added to the Panel so we can determine their vertical positioning.
int i = -1;
foreach (Skill objSkill in _objCharacter.Skills)
{
if (!objSkill.KnowledgeSkill && !objSkill.ExoticSkill)
{
i++;
SkillControl objSkillControl = new SkillControl();
objSkillControl.SkillObject = objSkill;
// Attach an EventHandler for the RatingChanged and SpecializationChanged Events.
objSkillControl.RatingChanged += objActiveSkill_RatingChanged;
objSkillControl.SpecializationChanged += objSkill_SpecializationChanged;
objSkillControl.SpecializationLeave += objSkill_SpecializationLeave;
objSkillControl.SkillKarmaClicked += objSkill_KarmaClicked;
objSkillControl.DiceRollerClicked += objSkill_DiceRollerClicked;
objSkillControl.SkillName = objSkill.Name;
objSkillControl.SkillCategory = objSkill.SkillCategory;
objSkillControl.SkillGroup = objSkill.SkillGroup;
objSkillControl.SkillRatingMaximum = objSkill.RatingMaximum;
objSkillControl.SkillRating = objSkill.Rating;
objSkillControl.SkillSpec = objSkill.Specialization;
XmlNode objXmlSkill = objXmlDocument.SelectSingleNode("/chummer/skills/skill[name = \"" + objSkill.Name + "\"]");
// Populate the Skill's Specializations (if any).
foreach (XmlNode objXmlSpecialization in objXmlSkill.SelectNodes("specs/spec"))
{
if (objXmlSpecialization.Attributes["translate"] != null)
objSkillControl.AddSpec(objXmlSpecialization.Attributes["translate"].InnerText);
else
objSkillControl.AddSpec(objXmlSpecialization.InnerText);
}
// Set the control's vertical position and add it to the Skills Panel.
objSkillControl.Width = 510;
objSkillControl.AutoScroll = false;
panActiveSkills.Controls.Add(objSkillControl);
// Determine if this Skill should be added to the list of Skills for Comlex Form Tests.
示例9: PickCyberware
//.........这里部分代码省略.........
treWeapons.Nodes[0].Nodes.Add(objWeaponNode);
treWeapons.Nodes[0].Expand();
}
// Determine the lowest whole number for the character's Essence after adding the 'Ware.
decimal decEndingESS = Math.Floor(_objCharacter.Essence);
decimal decDifferent = decStartingESS - decEndingESS;
if (decDifferent > 0.0m)
{
// Permanently reduce the character's MAG/RES Attributes.
_objCharacter.MAG.Value -= Convert.ToInt32(decDifferent);
_objCharacter.RES.Value -= Convert.ToInt32(decDifferent);
// If the Attribute reaches 0, the character has burned out.
if (_objCharacter.MAG.Value < 1)
{
_objCharacter.MAG.Value = 0;
_objCharacter.MAG.MetatypeMinimum = 0;
_objCharacter.MAG.MetatypeMaximum = 0;
_objCharacter.MAG.MetatypeAugmentedMaximum = 0;
if (_objCharacter.MAGEnabled)
{
// Move all MAG-linked Active Skills to Knowledge Skills.
List<Skill> lstNewSkills = new List<Skill>();
foreach (Skill objSkill in _objCharacter.Skills)
{
if (objSkill.Attribute == "MAG" && objSkill.Rating > 0)
{
int i = panKnowledgeSkills.Controls.Count;
Skill objKnowledge = new Skill(_objCharacter);
SkillControl objSkillControl = new SkillControl();
objKnowledge.Name = objSkill.Name;
objSkillControl.SkillObject = objKnowledge;
// Attach an EventHandler for the RatingChanged and SpecializationChanged Events.
objSkillControl.RatingChanged += objKnowledgeSkill_RatingChanged;
objSkillControl.SpecializationChanged += objSkill_SpecializationChanged;
objSkillControl.DeleteSkill += objKnowledgeSkill_DeleteSkill;
objSkillControl.SkillKarmaClicked += objKnowledgeSkill_KarmaClicked;
objSkillControl.DiceRollerClicked += objSkill_DiceRollerClicked;
objSkillControl.KnowledgeSkill = true;
objSkillControl.AllowDelete = true;
if (objSkill.Rating > 7)
objSkillControl.SkillRatingMaximum = objSkill.Rating;
else
objSkillControl.SkillRatingMaximum = 6;
objSkillControl.SkillRating = objSkill.Rating;
objSkillControl.SkillCategory = "Professional";
// Set the SkillControl's Location since scrolling the Panel causes it to actually change the child Controls' Locations.
objSkillControl.Location = new Point(0, objSkillControl.Height * i + panKnowledgeSkills.AutoScrollPosition.Y);
panKnowledgeSkills.Controls.Add(objSkillControl);
lstNewSkills.Add(objKnowledge);
}
}
foreach (Skill objSkill in lstNewSkills)
_objCharacter.Skills.Add(objSkill);
}
_objCharacter.MAGEnabled = false;
_objCharacter.MagicianEnabled = false;
_objCharacter.AdeptEnabled = false;
示例10: cmdAddExoticSkill_Click
private void cmdAddExoticSkill_Click(object sender, EventArgs e)
{
frmSelectExoticSkill frmPickExoticSkill = new frmSelectExoticSkill();
frmPickExoticSkill.ShowDialog(this);
if (frmPickExoticSkill.DialogResult == DialogResult.Cancel)
return;
XmlDocument objXmlDocument = XmlManager.Instance.Load("skills.xml");
XmlNode nodSkill = objXmlDocument.SelectSingleNode("/chummer/skills/skill[name = \"" + frmPickExoticSkill.SelectedExoticSkill + "\"]");
int i = panActiveSkills.Controls.Count;
Skill objSkill = new Skill(_objCharacter);
SkillSpecialization objSkillSpec = new SkillSpecialization(frmPickExoticSkill.SelectedExoticSkillSpecialisation);
objSkill.Attribute = nodSkill["attribute"].InnerText;
objSkill.Specializations.Add(objSkillSpec);
if (_objCharacter.MaxSkillRating > 0)
objSkill.RatingMaximum = _objCharacter.MaxSkillRating;
SkillControl objSkillControl = new SkillControl();
objSkillControl.SkillObject = objSkill;
objSkillControl.Width = 510;
// Attach an EventHandler for the RatingChanged and SpecializationChanged Events.
objSkillControl.RatingChanged += objActiveSkill_RatingChanged;
objSkillControl.SpecializationChanged += objSkill_SpecializationChanged;
objSkillControl.SkillKarmaClicked += objSkill_KarmaClicked;
objSkillControl.SkillName = frmPickExoticSkill.SelectedExoticSkill;
objSkillControl.DiceRollerClicked += objSkill_DiceRollerClicked;
objSkillControl.DeleteSkill += objSkill_DeleteExoticSkill;
objSkillControl.SkillCategory = nodSkill["category"].InnerText;
if (nodSkill["default"].InnerText == "Yes")
objSkill.Default = true;
else
objSkill.Default = false;
objSkill.ExoticSkill = true;
_objCharacter.Skills.Add(objSkill);
objSkillControl.SkillRatingMaximum = 12;
// Set the SkillControl's Location since scrolling the Panel causes it to actually change the child Controls' Locations.
objSkillControl.Location = new Point(0, objSkillControl.Height * i + panActiveSkills.AutoScrollPosition.Y);
panActiveSkills.Controls.Add(objSkillControl);
_blnIsDirty = true;
UpdateWindowTitle();
}