本文整理汇总了C#中Gear.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Gear.GetType方法的具体用法?C# Gear.GetType怎么用?C# Gear.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gear
的用法示例。
在下文中一共展示了Gear.GetType方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: chkActiveCommlink_CheckedChanged
private void chkActiveCommlink_CheckedChanged(object sender, EventArgs e)
{
if (_blnSkipRefresh)
return;
Gear objSelectedGear = new Gear(_objCharacter);
// Attempt to locate the selected piece of Gear.
try
{
objSelectedGear = _objFunctions.FindGear(treGear.SelectedNode.Tag.ToString(), _objCharacter.Gear);
if (objSelectedGear.GetType() != typeof(Commlink))
return;
Commlink objCommlink = (Commlink)objSelectedGear;
objCommlink.IsActive = chkActiveCommlink.Checked;
ChangeActiveCommlink(objCommlink);
RefreshSelectedGear();
UpdateCharacterInfo();
_blnIsDirty = true;
UpdateWindowTitle();
}
catch
{
}
}
示例2: RefreshSelectedGear
/// <summary>
/// Refresh the information for the currently displayed Gear.
/// </summary>
public void RefreshSelectedGear()
{
bool blnClear = false;
try
{
if (treGear.SelectedNode.Level == 0)
blnClear = true;
}
catch
{
blnClear = true;
}
if (blnClear)
{
_blnSkipRefresh = true;
nudGearRating.Minimum = 0;
nudGearRating.Maximum = 0;
nudGearRating.Enabled = false;
nudGearQty.Enabled = false;
chkGearEquipped.Text = LanguageManager.Instance.GetString("Checkbox_Equipped");
chkGearEquipped.Visible = false;
chkActiveCommlink.Visible = false;
_blnSkipRefresh = false;
return;
}
chkGearHomeNode.Visible = false;
if (treGear.SelectedNode.Level > 0)
{
Gear objGear = new Gear(_objCharacter);
objGear = _objFunctions.FindGear(treGear.SelectedNode.Tag.ToString(), _objCharacter.Gear);
lblGearName.Text = objGear.DisplayNameShort;
lblGearCategory.Text = objGear.DisplayCategory;
lblGearAvail.Text = objGear.TotalAvail(true);
try
{
lblGearCost.Text = String.Format("{0:###,###,##0¥}", objGear.TotalCost);
}
catch
{
lblGearCost.Text = objGear.Cost;
}
lblGearCapacity.Text = objGear.CalculatedCapacity + " (" + objGear.CapacityRemaining.ToString() + " " + LanguageManager.Instance.GetString("String_Remaining") + ")";
string strBook = _objOptions.LanguageBookShort(objGear.Source);
string strPage = objGear.Page;
lblGearSource.Text = strBook + " " + strPage;
tipTooltip.SetToolTip(lblGearSource, _objOptions.LanguageBookLong(objGear.Source) + " " + LanguageManager.Instance.GetString("String_Page") + " " + objGear.Page);
if (objGear.GetType() == typeof(Commlink))
{
Commlink objCommlink = (Commlink)objGear;
List<string> objASDF = new List<string>() { objCommlink.Attack.ToString(), objCommlink.Sleaze.ToString(), objCommlink.DataProcessing.ToString(), objCommlink.Firewall.ToString() };
cboGearAttack.BindingContext = new BindingContext();
cboGearAttack.ValueMember = "Value";
cboGearAttack.DisplayMember = "Name";
cboGearAttack.DataSource = objASDF;
cboGearAttack.SelectedIndex = 0;
cboGearAttack.Visible = true;
cboGearSleaze.BindingContext = new BindingContext();
cboGearSleaze.ValueMember = "Value";
cboGearSleaze.DisplayMember = "Name";
cboGearSleaze.DataSource = objASDF;
cboGearSleaze.SelectedIndex = 1;
cboGearDataProcessing.BindingContext = new BindingContext();
cboGearDataProcessing.ValueMember = "Value";
cboGearDataProcessing.DisplayMember = "Name";
cboGearDataProcessing.DataSource = objASDF;
cboGearDataProcessing.SelectedIndex = 2;
cboGearFirewall.BindingContext = new BindingContext();
cboGearFirewall.ValueMember = "Value";
cboGearFirewall.DisplayMember = "Name";
cboGearFirewall.DataSource = objASDF;
cboGearFirewall.SelectedIndex = 3;
lblGearDeviceRating.Text = objCommlink.TotalDeviceRating.ToString();
lblGearDeviceRating.Visible = true;
cboGearAttack.Visible = true;
cboGearSleaze.Visible = true;
cboGearDataProcessing.Visible = true;
cboGearFirewall.Visible = true;
lblGearDeviceRatingLabel.Visible = true;
lblGearAttackLabel.Visible = true;
lblGearSleazeLabel.Visible = true;
lblGearDataProcessingLabel.Visible = true;
lblGearFirewallLabel.Visible = true;
_blnSkipRefresh = true;
chkActiveCommlink.Checked = objCommlink.IsActive;
_blnSkipRefresh = false;
if (objCommlink.Category != "Commlink Upgrade")
chkActiveCommlink.Visible = true;
if (_objCharacter.Metatype == "A.I.")
{
//.........这里部分代码省略.........
示例3: RefreshSelectedGear
/// <summary>
/// Refresh the information for the currently displayed Gear.
/// </summary>
public void RefreshSelectedGear()
{
bool blnClear = false;
try
{
if (treGear.SelectedNode.Level == 0)
blnClear = true;
}
catch
{
blnClear = true;
}
if (blnClear)
{
lblGearRating.Text = "";
lblGearQty.Text = "";
cmdGearIncreaseQty.Enabled = false;
cmdGearReduceQty.Enabled = false;
chkGearEquipped.Text = LanguageManager.Instance.GetString("Checkbox_Equipped");
chkGearEquipped.Visible = false;
chkActiveCommlink.Visible = false;
cmdGearSplitQty.Enabled = false;
cmdGearMergeQty.Enabled = false;
cmdGearMoveToVehicle.Enabled = false;
return;
}
cmdGearIncreaseQty.Enabled = false;
chkGearHomeNode.Visible = false;
if (treGear.SelectedNode.Level > 0)
{
Gear objGear = new Gear(_objCharacter);
objGear = _objFunctions.FindGear(treGear.SelectedNode.Tag.ToString(), _objCharacter.Gear);
lblGearName.Text = objGear.DisplayNameShort;
lblGearCategory.Text = objGear.DisplayCategory;
lblGearAvail.Text = objGear.TotalAvail(true);
try
{
lblGearCost.Text = String.Format("{0:###,###,##0¥}", objGear.TotalCost);
}
catch
{
lblGearCost.Text = objGear.Cost;
}
lblGearCapacity.Text = objGear.CalculatedCapacity + " (" + objGear.CapacityRemaining.ToString() + " " + LanguageManager.Instance.GetString("String_Remaining") + ")";
string strBook = _objOptions.LanguageBookShort(objGear.Source);
string strPage = objGear.Page;
lblGearSource.Text = strBook + " " + strPage;
tipTooltip.SetToolTip(lblGearSource, _objOptions.LanguageBookLong(objGear.Source) + " " + LanguageManager.Instance.GetString("String_Page") + " " + objGear.Page);
if (objGear.Category == "Ammunition")
cmdGearIncreaseQty.Enabled = true;
if (objGear.GetType() == typeof(Commlink))
{
Commlink objCommlink = (Commlink)objGear;
lblGearDeviceRating.Text = objCommlink.TotalDeviceRating.ToString();
lblGearAttack.Text = objCommlink.Attack.ToString();
lblGearSleaze.Text = objCommlink.Sleaze.ToString();
lblGearDataProcessing.Text = objCommlink.DataProcessing.ToString();
lblGearFirewall.Text = objCommlink.Firewall.ToString();
_blnSkipRefresh = true;
chkActiveCommlink.Checked = objCommlink.IsActive;
_blnSkipRefresh = false;
lblGearDeviceRating.Visible = true;
lblGearAttack.Visible = true;
lblGearSleaze.Visible = true;
lblGearDataProcessing.Visible = true;
lblGearFirewall.Visible = true;
lblGearDeviceRatingLabel.Visible = true;
lblGearAttackLabel.Visible = true;
lblGearSleazeLabel.Visible = true;
lblGearDataProcessingLabel.Visible = true;
lblGearFirewallLabel.Visible = true;
if (objCommlink.Category != "Commlink Upgrade")
chkActiveCommlink.Visible = true;
}
else
{
lblGearDeviceRating.Text = objGear.DeviceRating.ToString();
chkActiveCommlink.Visible = false;
lblGearAttack.Visible = false;
lblGearSleaze.Visible = false;
lblGearDataProcessing.Visible = false;
lblGearFirewall.Visible = false;
lblGearAttackLabel.Visible = false;
lblGearSleazeLabel.Visible = false;
lblGearDataProcessingLabel.Visible = false;
lblGearFirewallLabel.Visible = false;
}
if (objGear.MaxRating > 0)
lblGearRating.Text = objGear.Rating.ToString();
else
//.........这里部分代码省略.........
示例4: RefreshSelectedGear
/// <summary>
/// Refresh the information for the currently displayed Gear.
/// </summary>
public void RefreshSelectedGear()
{
bool blnClear = false;
try
{
if (treGear.SelectedNode.Level == 0)
blnClear = true;
}
catch
{
blnClear = true;
}
if (blnClear)
{
_blnSkipRefresh = true;
nudGearRating.Minimum = 0;
nudGearRating.Maximum = 0;
nudGearRating.Enabled = false;
nudGearQty.Enabled = false;
chkGearEquipped.Text = LanguageManager.Instance.GetString("Checkbox_Equipped");
chkGearEquipped.Visible = false;
chkActiveCommlink.Visible = false;
_blnSkipRefresh = false;
return;
}
chkGearHomeNode.Visible = false;
if (treGear.SelectedNode.Level > 0)
{
Gear objGear = new Gear(_objCharacter);
objGear = _objFunctions.FindGear(treGear.SelectedNode.Tag.ToString(), _objCharacter.Gear);
lblGearName.Text = objGear.DisplayNameShort;
lblGearCategory.Text = objGear.DisplayCategory;
lblGearAvail.Text = objGear.TotalAvail(true);
try
{
lblGearCost.Text = String.Format("{0:###,###,##0¥}", objGear.TotalCost);
}
catch
{
lblGearCost.Text = objGear.Cost;
}
lblGearCapacity.Text = objGear.CalculatedCapacity + " (" + objGear.CapacityRemaining.ToString() + " " + LanguageManager.Instance.GetString("String_Remaining") + ")";
string strBook = _objOptions.LanguageBookShort(objGear.Source);
string strPage = objGear.Page;
lblGearSource.Text = strBook + " " + strPage;
tipTooltip.SetToolTip(lblGearSource, _objOptions.LanguageBookLong(objGear.Source) + " " + LanguageManager.Instance.GetString("String_Page") + " " + objGear.Page);
if (objGear.GetType() == typeof(Commlink))
{
Commlink objCommlink = (Commlink)objGear;
lblGearResponse.Text = objCommlink.TotalResponse.ToString();
lblGearSignal.Text = objCommlink.TotalSignal.ToString();
if (objCommlink.Category != "Commlink Upgrade")
{
lblGearSystem.Text = objCommlink.TotalSystem.ToString();
lblGearFirewall.Text = objCommlink.TotalFirewall.ToString();
}
else
{
lblGearSystem.Text = "";
lblGearFirewall.Text = "";
}
_blnSkipRefresh = true;
chkActiveCommlink.Checked = objCommlink.IsActive;
_blnSkipRefresh = false;
if (objCommlink.Category != "Commlink Upgrade")
chkActiveCommlink.Visible = true;
}
else if (objGear.GetType() == typeof(OperatingSystem))
{
OperatingSystem objOS = (OperatingSystem)objGear;
lblGearResponse.Text = "";
lblGearSignal.Text = "";
lblGearSystem.Text = objOS.System.ToString();
lblGearFirewall.Text = objOS.Firewall.ToString();
chkActiveCommlink.Visible = false;
}
else
{
lblGearResponse.Text = objGear.Response.ToString();
lblGearSignal.Text = objGear.Signal.ToString();
lblGearSystem.Text = objGear.System.ToString();
lblGearFirewall.Text = objGear.Firewall.ToString();
chkActiveCommlink.Visible = false;
}
if (objGear.MaxRating > 0)
{
_blnSkipRefresh = true;
if (objGear.MinRating > 0)
nudGearRating.Minimum = objGear.MinRating;
else if (objGear.MinRating == 0 && objGear.Name.Contains("Credstick,"))
nudGearRating.Minimum = 0;
//.........这里部分代码省略.........
示例5: chkGearCM_CheckedChanged
private void chkGearCM_CheckedChanged(object sender, EventArgs e)
{
if (_blnSkipRefresh)
return;
// Locate the selected Gear.
TreeNode objGearNode = new TreeNode();
objGearNode = treGear.SelectedNode;
if (treGear.SelectedNode.Level > 1)
{
while (objGearNode.Level > 1)
objGearNode = objGearNode.Parent;
}
Gear objGear = new Gear(_objCharacter);
foreach (Gear objCharacterGear in _objCharacter.Gear)
{
if (objCharacterGear.InternalId == objGearNode.Tag.ToString())
{
objGear = objCharacterGear;
break;
}
}
int intFillCount = 0;
CheckBox objCheck = (CheckBox)sender;
{
if (objCheck.Checked)
{
// If this is being checked, make sure everything before it is checked off.
_blnSkipRefresh = true;
foreach (CheckBox objGearCM in tabMatrixCM.Controls.OfType<CheckBox>())
{
if (Convert.ToInt32(objGearCM.Tag.ToString()) < Convert.ToInt32(objCheck.Tag.ToString()))
objGearCM.Checked = true;
if (objGearCM.Checked)
intFillCount += 1;
}
_blnSkipRefresh = false;
}
else
{
// If this is being unchecked, make sure everything after it is unchecked.
_blnSkipRefresh = true;
foreach (CheckBox objGearCM in tabMatrixCM.Controls.OfType<CheckBox>())
{
if (Convert.ToInt32(objGearCM.Tag.ToString()) > Convert.ToInt32(objCheck.Tag.ToString()))
objGearCM.Checked = false;
if (objGearCM.Checked)
intFillCount += 1;
}
_blnSkipRefresh = false;
}
if (objGear.GetType() == typeof(Commlink))
{
Commlink objCommlink = (Commlink)objGear;
objCommlink.MatrixCMFilled = intFillCount;
}
else
{
objGear.MatrixCMFilled = intFillCount;
}
UpdateCharacterInfo();
_blnIsDirty = true;
UpdateWindowTitle();
}
}
示例6: RefreshSelectedGear
/// <summary>
/// Refresh the information for the currently displayed Gear.
/// </summary>
public void RefreshSelectedGear()
{
bool blnClear = false;
try
{
if (treGear.SelectedNode.Level == 0)
blnClear = true;
}
catch
{
blnClear = true;
}
if (blnClear)
{
lblGearRating.Text = "";
lblGearQty.Text = "";
cmdGearIncreaseQty.Enabled = false;
cmdGearReduceQty.Enabled = false;
chkGearEquipped.Text = LanguageManager.Instance.GetString("Checkbox_Equipped");
chkGearEquipped.Visible = false;
chkActiveCommlink.Visible = false;
cmdGearSplitQty.Enabled = false;
cmdGearMergeQty.Enabled = false;
cmdGearMoveToVehicle.Enabled = false;
tabGearMatrixCM.Visible = false;
return;
}
cmdGearIncreaseQty.Enabled = false;
chkGearHomeNode.Visible = false;
if (treGear.SelectedNode.Level > 0)
{
Gear objGear = new Gear(_objCharacter);
objGear = _objFunctions.FindGear(treGear.SelectedNode.Tag.ToString(), _objCharacter.Gear);
lblGearName.Text = objGear.DisplayNameShort;
lblGearCategory.Text = objGear.DisplayCategory;
lblGearAvail.Text = objGear.TotalAvail(true);
try
{
lblGearCost.Text = String.Format("{0:###,###,##0¥}", objGear.TotalCost);
}
catch
{
lblGearCost.Text = objGear.Cost;
}
lblGearCapacity.Text = objGear.CalculatedCapacity + " (" + objGear.CapacityRemaining.ToString() + " " + LanguageManager.Instance.GetString("String_Remaining") + ")";
string strBook = _objOptions.LanguageBookShort(objGear.Source);
string strPage = objGear.Page;
lblGearSource.Text = strBook + " " + strPage;
tipTooltip.SetToolTip(lblGearSource, _objOptions.LanguageBookLong(objGear.Source) + " " + LanguageManager.Instance.GetString("String_Page") + " " + objGear.Page);
_blnSkipRefresh = true;
if (objGear.DeviceRating > 0)
{
tabGearMatrixCM.Visible = true;
foreach (CheckBox objMatrixCM in tabMatrixCM.Controls.OfType<CheckBox>())
{
if (Convert.ToInt32(objMatrixCM.Tag.ToString()) <= objGear.MatrixCM)
{
if (Convert.ToInt32(objMatrixCM.Tag.ToString()) <= objGear.MatrixCMFilled)
objMatrixCM.Checked = true;
else
objMatrixCM.Checked = false;
objMatrixCM.Visible = true;
}
else
{
objMatrixCM.Checked = false;
objMatrixCM.Visible = false;
objMatrixCM.Text = "";
}
}
}
else
{
tabGearMatrixCM.Visible = false;
}
_blnSkipRefresh = false;
if (objGear.Category == "Ammunition")
cmdGearIncreaseQty.Enabled = true;
if (objGear.GetType() == typeof(Commlink))
{
Commlink objCommlink = (Commlink)objGear;
lblGearDeviceRating.Text = objCommlink.TotalDeviceRating.ToString();
_blnSkipRefresh = true;
chkActiveCommlink.Checked = objCommlink.IsActive;
_blnSkipRefresh = false;
cboGearOverclocker.Visible = _objCharacter.Overclocker;
lblGearOverclocker.Visible = _objCharacter.Overclocker;
ArrayList lstOverclocker = new ArrayList();
ListItem objAttribute = new ListItem();
objAttribute.Value = "None";
//.........这里部分代码省略.........
示例7: UpdateGearInfo
/// <summary>
/// Update the Gear's information based on the Gear selected and current Rating.
/// </summary>
private void UpdateGearInfo()
{
if (lstGear.Text != "")
{
// Retireve the information for the selected piece of Cyberware.
XmlNode objXmlGear;
int intItemCost = 0;
string strCategory = "";
objXmlGear = _objXmlDocument.SelectSingleNode("/chummer/gears/gear[id = \"" + lstGear.SelectedValue + "\"]");
strCategory = cboCategory.SelectedValue.ToString();
TreeNode objTreeNode = new TreeNode();
List<Weapon> lstWeapons = new List<Weapon>();
List<TreeNode> lstTreeNodes = new List<TreeNode>();
Gear objGear = new Gear(_objCharacter);
Commlink objCommlink = new Commlink(_objCharacter);
OperatingSystem objOperatingSystem = new OperatingSystem(_objCharacter);
if (objXmlGear["category"].InnerText == "Commlink" || objXmlGear["category"].InnerText == "Commlink Upgrade")
{
objCommlink.Create(objXmlGear, _objCharacter, objTreeNode, Convert.ToInt32(nudRating.Value), false, true);
objGear = (Gear)objCommlink;
}
else if (objXmlGear["category"].InnerText == "Operating System" || objXmlGear["category"].InnerText == "Operating System Upgrade")
{
objOperatingSystem.Create(objXmlGear, _objCharacter, objTreeNode, Convert.ToInt32(nudRating.Value), false, true);
objGear = (Gear)objCommlink;
}
else
objGear.Create(objXmlGear, _objCharacter, objTreeNode, Convert.ToInt32(nudRating.Value), lstWeapons, lstTreeNodes, "", chkHacked.Checked, false, false, true, chkAerodynamic.Checked);
if (_objCharacter.Metatype == "A.I." || _objCharacter.MetatypeCategory == "Technocritters" || _objCharacter.MetatypeCategory == "Protosapients")
{
if ((strCategory == "Matrix Programs" || strCategory == "Skillsofts" || strCategory == "Autosofts" || strCategory == "Autosofts, Agent" || strCategory == "Autosofts, Drone") && _objCharacter.Options.BookEnabled("UN") && !lstGear.SelectedValue.ToString().StartsWith("Suite:"))
chkInherentProgram.Visible = true;
else
chkInherentProgram.Visible = false;
chkInherentProgram.Enabled = !chkHacked.Checked;
if (!chkInherentProgram.Enabled)
chkInherentProgram.Checked = false;
}
else
chkInherentProgram.Visible = false;
if (objGear.GetType() == typeof(Commlink))
{
lblGearResponse.Text = objCommlink.TotalResponse.ToString();
lblGearSignal.Text = objCommlink.TotalSignal.ToString();
lblGearSystem.Text = "";
lblGearFirewall.Text = "";
}
else if (objGear.GetType() == typeof(OperatingSystem))
{
lblGearResponse.Text = "";
lblGearSignal.Text = "";
lblGearSystem.Text = objOperatingSystem.System.ToString();
lblGearFirewall.Text = objOperatingSystem.Firewall.ToString();
}
else
{
lblGearResponse.Text = "";
lblGearSignal.Text = "";
lblGearSystem.Text = "";
lblGearFirewall.Text = "";
}
if (objXmlGear["category"].InnerText.EndsWith("Software") || objXmlGear["category"].InnerText.EndsWith("Programs") || objXmlGear["category"].InnerText == "Program Options" || objXmlGear["category"].InnerText.StartsWith("Autosofts") || objXmlGear["category"].InnerText.StartsWith("Skillsoft") || objXmlGear["category"].InnerText == "Program Packages" || objXmlGear["category"].InnerText == "Software Suites")
chkHacked.Visible = true;
else
chkHacked.Visible = false;
string strBook = _objCharacter.Options.LanguageBookShort(objGear.Source);
string strPage = objGear.Page;
lblSource.Text = strBook + " " + strPage;
// Avail.
lblAvail.Text = objGear.TotalAvail();
double dblMultiplier = Convert.ToDouble(nudGearQty.Value / nudGearQty.Increment, GlobalOptions.Instance.CultureInfo);
if (chkDoItYourself.Checked)
dblMultiplier *= 0.5;
// Cost.
if (objGear.Cost.StartsWith("Variable"))
{
int intMin = 0;
int intMax = 0;
string strCost = objGear.Cost.Replace("Variable(", string.Empty).Replace(")", string.Empty);
if (strCost.Contains("-"))
{
string[] strValues = strCost.Split('-');
intMin = Convert.ToInt32(strValues[0]);
intMax = Convert.ToInt32(strValues[1]);
}
else
intMin = Convert.ToInt32(strCost.Replace("+", string.Empty));
//.........这里部分代码省略.........