本文整理汇总了C#中Chummer.ExpenseUndo类 的典型用法代码示例。如果您正苦于以下问题:C# ExpenseUndo类的具体用法?C# ExpenseUndo怎么用?C# ExpenseUndo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExpenseUndo类 属于Chummer命名空间,在下文中一共展示了ExpenseUndo类 的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: tsMetamagicAddRitual_Click
private void tsMetamagicAddRitual_Click(object sender, EventArgs e)
{
// Character can only have a number of Metamagics/Echoes equal to their Initiate Grade. Additional ones cost Karma.
bool blnPayWithKarma = false;
string strType = "";
if (treMetamagic.SelectedNode.Level != 0)
return;
int intGrade = 0;
foreach (InitiationGrade objGrade in _objCharacter.InitiationGrades)
{
if (objGrade.InternalId == treMetamagic.SelectedNode.Tag.ToString())
{
intGrade = objGrade.Grade;
break;
}
}
// Evaluate each object
foreach (Metamagic objMetamagic in _objCharacter.Metamagics)
{
if (objMetamagic.Grade == intGrade)
blnPayWithKarma = true;
}
foreach (Spell objSpell in _objCharacter.Spells)
{
if (objSpell.Grade == intGrade)
blnPayWithKarma = true;
}
if (blnPayWithKarma && _objCharacter.Karma < _objOptions.KarmaSpell)
{
// Make sure the Karma expense would not put them over the limit.
MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughKarma"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughKarma"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (blnPayWithKarma)
if (!ConfirmKarmaExpense(LanguageManager.Instance.GetString("Message_ConfirmKarmaExpenseSpend").Replace("{0}", LanguageManager.Instance.GetString("String_Ritual")).Replace("{1}", _objOptions.KarmaSpell.ToString())))
return;
frmSelectArt frmPickArt = new frmSelectArt(_objCharacter);
frmPickArt.WindowMode = frmSelectArt.Mode.Ritual;
frmPickArt.ShowDialog(this);
// Make sure a value was selected.
if (frmPickArt.DialogResult == DialogResult.Cancel)
return;
string strEnchantment = frmPickArt.SelectedItem;
XmlDocument objXmlDocument = new XmlDocument();
XmlNode objXmlArt;
TreeNode objNode = new TreeNode();
Spell objNewSpell = new Spell(_objCharacter);
Improvement.ImprovementSource objSource;
objXmlDocument = XmlManager.Instance.Load("spells.xml");
objXmlArt = objXmlDocument.SelectSingleNode("/chummer/spells/spell[name = \"" + strEnchantment + "\"]");
objSource = Improvement.ImprovementSource.Initiation;
objNewSpell.Create(objXmlArt, _objCharacter, objNode, "", false, false, false, objSource);
objNewSpell.Grade = intGrade;
objNode.ContextMenuStrip = cmsInitiationNotes;
if (objNewSpell.InternalId == Guid.Empty.ToString())
return;
_objCharacter.Spells.Add(objNewSpell);
if (blnPayWithKarma)
{
// Create the Expense Log Entry.
ExpenseLogEntry objEntry = new ExpenseLogEntry();
objEntry.Create(_objOptions.KarmaSpell * -1, strType + " " + frmPickArt.SelectedItem, ExpenseType.Karma, DateTime.Now);
_objCharacter.ExpenseEntries.Add(objEntry);
ExpenseUndo objUndo = new ExpenseUndo();
objUndo.CreateKarma(KarmaExpenseType.AddSpell, objNewSpell.InternalId);
objEntry.Undo = objUndo;
// Adjust the character's Karma total.
_objCharacter.Karma -= _objOptions.KarmaSpell;
}
TreeNode objSpellNode = new TreeNode();
objSpellNode.Text = objNode.Text;
objSpellNode.Tag = objNode.Tag;
string strCategory = "";
if (objNewSpell.Category == "Rituals")
strCategory = LanguageManager.Instance.GetString("Label_Ritual") + " ";
if (objNewSpell.Category == "Enchantments")
strCategory = LanguageManager.Instance.GetString("Label_Enchantment") + " ";
objNode.Text = strCategory + objNode.Text;
treMetamagic.SelectedNode.Nodes.Add(objNode);
treMetamagic.SelectedNode.Expand();
//.........这里部分代码省略.........
开发者ID:Althalusdlg, 项目名称:chummer5a, 代码行数:101, 代码来源:frmCareer.cs
示例2: cmdQuickenSpell_Click
private void cmdQuickenSpell_Click(object sender, EventArgs e)
{
try
{
if (treSpells.SelectedNode.Level != 1)
return;
}
catch
{
return;
}
frmSelectNumber frmPickNumber = new frmSelectNumber();
frmPickNumber.Description = LanguageManager.Instance.GetString("String_QuickeningKarma").Replace("{0}", treSpells.SelectedNode.Text);
frmPickNumber.Minimum = 1;
frmPickNumber.ShowDialog(this);
if (frmPickNumber.DialogResult == DialogResult.Cancel)
return;
// Make sure the character has enough Karma to improve the Attribute.
int intKarmaCost = frmPickNumber.SelectedValue;
if (intKarmaCost > _objCharacter.Karma)
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughKarma"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughKarma"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (!ConfirmKarmaExpense(LanguageManager.Instance.GetString("Message_ConfirmKarmaExpenseQuickeningMetamagic").Replace("{0}", intKarmaCost.ToString()).Replace("{1}", treSpells.SelectedNode.Text)))
return;
// Create the Karma expense.
ExpenseLogEntry objExpense = new ExpenseLogEntry();
objExpense.Create(intKarmaCost * -1, LanguageManager.Instance.GetString("String_ExpenseQuickenMetamagic") + " " + treSpells.SelectedNode.Text, ExpenseType.Karma, DateTime.Now);
_objCharacter.ExpenseEntries.Add(objExpense);
_objCharacter.Karma -= intKarmaCost;
ExpenseUndo objUndo = new ExpenseUndo();
objUndo.CreateKarma(KarmaExpenseType.QuickeningMetamagic, "");
objExpense.Undo = objUndo;
UpdateCharacterInfo();
_blnIsDirty = true;
UpdateWindowTitle();
}
开发者ID:Althalusdlg, 项目名称:chummer5a, 代码行数:46, 代码来源:frmCareer.cs
示例3: SaveCharacterAsCreated
/// <summary>
/// Save the character as Created and re-open it in Career Mode.
/// </summary>
private void SaveCharacterAsCreated()
{
// If the character was built with Karma, record their staring Karma amount (if any).
if (_objCharacter.BuildMethod == CharacterBuildMethod.Karma)
{
if (_objCharacter.Karma > 0)
{
ExpenseLogEntry objKarma = new ExpenseLogEntry();
objKarma.Create(_objCharacter.Karma, "Starting Karma", ExpenseType.Karma, DateTime.Now);
_objCharacter.ExpenseEntries.Add(objKarma);
// Create an Undo entry so that the starting Karma amount can be modified if needed.
ExpenseUndo objKarmaUndo = new ExpenseUndo();
objKarmaUndo.CreateKarma(KarmaExpenseType.ManualAdd, "");
objKarma.Undo = objKarmaUndo;
}
}
// Create an Expense Entry for Starting Nuyen.
ExpenseLogEntry objNuyen = new ExpenseLogEntry();
objNuyen.Create(_objCharacter.Nuyen, "Starting Nuyen", ExpenseType.Nuyen, DateTime.Now);
_objCharacter.ExpenseEntries.Add(objNuyen);
// Create an Undo entry so that the Starting Nuyen amount can be modified if needed.
ExpenseUndo objNuyenUndo = new ExpenseUndo();
objNuyenUndo.CreateNuyen(NuyenExpenseType.ManualAdd, "");
objNuyen.Undo = objNuyenUndo;
_blnSkipToolStripRevert = true;
_objCharacter.Save();
GlobalOptions.Instance.MainForm.LoadCharacter(_objCharacter.FileName, false);
this.Close();
}
开发者ID:janhelke, 项目名称:chummer2, 代码行数:37, 代码来源:frmCreate.cs
示例4: cmdIncreaseLifestyleMonths_Click
private void cmdIncreaseLifestyleMonths_Click(object sender, EventArgs e)
{
try
{
if (treLifestyles.SelectedNode == null)
return;
}
catch
{
return;
}
// Locate the selected Lifestyle.
Lifestyle objLifestyle = _objFunctions.FindLifestyle(treLifestyles.SelectedNode.Tag.ToString(), _objCharacter.Lifestyles);
if (objLifestyle == null)
return;
// Create the Expense Log Entry.
int intAmount = objLifestyle.TotalMonthlyCost;
if (intAmount > _objCharacter.Nuyen)
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughNuyen"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughNuyen"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
ExpenseLogEntry objExpense = new ExpenseLogEntry();
objExpense.Create(intAmount * -1, LanguageManager.Instance.GetString("String_ExpenseLifestyle") + " " + objLifestyle.DisplayNameShort, ExpenseType.Nuyen, DateTime.Now);
_objCharacter.ExpenseEntries.Add(objExpense);
_objCharacter.Nuyen -= intAmount;
ExpenseUndo objUndo = new ExpenseUndo();
objUndo.CreateNuyen(NuyenExpenseType.IncreaseLifestyle, objLifestyle.Name);
objExpense.Undo = objUndo;
objLifestyle.Months += 1;
lblLifestyleMonths.Text = objLifestyle.Months.ToString();
UpdateCharacterInfo();
_blnIsDirty = true;
UpdateWindowTitle();
}
开发者ID:Althalusdlg, 项目名称:chummer5a, 代码行数:42, 代码来源:frmCareer.cs
示例5: cmdNuyenGained_Click
private void cmdNuyenGained_Click(object sender, EventArgs e)
{
frmExpense frmNewExpense = new frmExpense();
frmNewExpense.Mode = ExpenseType.Nuyen;
frmNewExpense.ShowDialog(this);
if (frmNewExpense.DialogResult == DialogResult.Cancel)
return;
// Create the Expense Log Entry.
ExpenseLogEntry objEntry = new ExpenseLogEntry();
objEntry.Create(frmNewExpense.Amount, frmNewExpense.strReason, ExpenseType.Nuyen, frmNewExpense.SelectedDate);
objEntry.Refund = frmNewExpense.Refund;
_objCharacter.ExpenseEntries.Add(objEntry);
ExpenseUndo objUndo = new ExpenseUndo();
objUndo.CreateNuyen(NuyenExpenseType.ManualAdd, "");
objEntry.Undo = objUndo;
// Adjust the character's Nuyen total.
_objCharacter.Nuyen += frmNewExpense.Amount;
UpdateCharacterInfo();
_blnIsDirty = true;
UpdateWindowTitle();
}
开发者ID:Althalusdlg, 项目名称:chummer5a, 代码行数:27, 代码来源:frmCareer.cs
示例6: cmdImproveComplexForm_Click
private void cmdImproveComplexForm_Click(object sender, EventArgs e)
{
if (treComplexForms.SelectedNode.Level == 1)
{
// Locate the Program that is selected in the tree.
ComplexForm objProgram = _objFunctions.FindComplexForm(treComplexForms.SelectedNode.Tag.ToString(), _objCharacter.ComplexForms);
// Make sure the character has enough Karma.
int intKarmaCost = _objOptions.KarmaImproveComplexForm;
if (intKarmaCost > _objCharacter.Karma)
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughKarma"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughKarma"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (!ConfirmKarmaExpense(LanguageManager.Instance.GetString("Message_ConfirmKarmaExpenseSpend").Replace("{0}", intKarmaCost.ToString()).Replace("{1}", objProgram.DisplayNameShort)))
return;
// Create the Expense Log Entry.
ExpenseLogEntry objExpense = new ExpenseLogEntry();
objExpense.Create(intKarmaCost * -1, LanguageManager.Instance.GetString("String_ExpenseComplexForm") + " " + objProgram.DisplayNameShort, ExpenseType.Karma, DateTime.Now);
_objCharacter.ExpenseEntries.Add(objExpense);
_objCharacter.Karma -= intKarmaCost;
ExpenseUndo objUndo = new ExpenseUndo();
objUndo.CreateKarma(KarmaExpenseType.ImproveComplexForm, objProgram.InternalId);
objExpense.Undo = objUndo;
treComplexForms.SelectedNode.Text = objProgram.DisplayName;
}
UpdateCharacterInfo();
_blnIsDirty = true;
UpdateWindowTitle();
}
开发者ID:Althalusdlg, 项目名称:chummer5a, 代码行数:37, 代码来源:frmCareer.cs
示例7: cmdImproveRES_Click
private void cmdImproveRES_Click(object sender, EventArgs e)
{
// Make sure the character has enough Karma to improve the Attribute.
int intKarmaCost = 0;
if (!_objOptions.SpecialKarmaCostBasedOnShownValue)
intKarmaCost = (_objCharacter.RES.Value + _objCharacter.RES.AttributeValueModifiers + 1) * _objOptions.KarmaAttribute;
else
intKarmaCost = (_objCharacter.RES.Value - _objCharacter.EssencePenalty + 1) * _objOptions.KarmaAttribute;
if (intKarmaCost > _objCharacter.Karma)
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughKarma"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughKarma"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
int intFromValue = 0;
if (!_objOptions.SpecialKarmaCostBasedOnShownValue)
intFromValue = _objCharacter.RES.Value + _objCharacter.RES.AttributeValueModifiers;
else
intFromValue = _objCharacter.RES.Value - _objCharacter.EssencePenalty;
if (!ConfirmKarmaExpense(LanguageManager.Instance.GetString("Message_ConfirmKarmaExpense").Replace("{0}", LanguageManager.Instance.GetString("String_AttributeRESShort")).Replace("{1}", (intFromValue + 1).ToString()).Replace("{2}", intKarmaCost.ToString())))
return;
// Create the Karma expense.
ExpenseLogEntry objExpense = new ExpenseLogEntry();
objExpense.Create(intKarmaCost * -1, LanguageManager.Instance.GetString("String_ExpenseAttribute") + " " + LanguageManager.Instance.GetString("String_AttributeRESShort") + " " + (intFromValue).ToString() + " -> " + (intFromValue + 1).ToString(), ExpenseType.Karma, DateTime.Now);
_objCharacter.ExpenseEntries.Add(objExpense);
_objCharacter.Karma -= intKarmaCost;
ExpenseUndo objUndo = new ExpenseUndo();
objUndo.CreateKarma(KarmaExpenseType.ImproveAttribute, "RES");
objExpense.Undo = objUndo;
_objCharacter.RES.Value += 1;
UpdateCharacterInfo();
_blnIsDirty = true;
UpdateWindowTitle();
}
开发者ID:Althalusdlg, 项目名称:chummer5a, 代码行数:41, 代码来源:frmCareer.cs
示例8: tsWeaponAccessoryGearMenuAddAsPlugin_Click
//.........这里部分代码省略.........
case "Cyberdecks":
case "Rigger Command Consoles":
Commlink objCommlink = new Commlink(_objCharacter);
objCommlink.Create(objXmlGear, _objCharacter, objNode, frmPickGear.SelectedRating);
objCommlink.Quantity = frmPickGear.SelectedQty;
objNode.Text = objCommlink.DisplayName;
objGear = objCommlink;
break;
default:
Gear objNewGear = new Gear(_objCharacter);
objNewGear.Create(objXmlGear, _objCharacter, objNode, frmPickGear.SelectedRating, objWeapons, objWeaponNodes, "", frmPickGear.Hacked, frmPickGear.InherentProgram, true, true, frmPickGear.Aerodynamic);
objNewGear.Quantity = frmPickGear.SelectedQty;
objNode.Text = objNewGear.DisplayName;
objGear = objNewGear;
break;
}
if (objGear.InternalId == Guid.Empty.ToString())
return;
// Reduce the cost for Do It Yourself components.
if (frmPickGear.DoItYourself)
objGear.Cost = (Convert.ToDouble(objGear.Cost, GlobalOptions.Instance.CultureInfo) * 0.5).ToString();
// Reduce the cost to 10% for Hacked programs.
if (frmPickGear.Hacked)
{
if (objGear.Cost != "")
objGear.Cost = "(" + objGear.Cost + ") * 0.1";
if (objGear.Cost3 != "")
objGear.Cost3 = "(" + objGear.Cost3 + ") * 0.1";
if (objGear.Cost6 != "")
objGear.Cost6 = "(" + objGear.Cost6 + ") * 0.1";
if (objGear.Cost10 != "")
objGear.Cost10 = "(" + objGear.Cost10 + ") * 0.1";
if (objGear.Extra == "")
objGear.Extra = LanguageManager.Instance.GetString("Label_SelectGear_Hacked");
else
objGear.Extra += ", " + LanguageManager.Instance.GetString("Label_SelectGear_Hacked");
}
// If the item was marked as free, change its cost.
if (frmPickGear.FreeCost)
{
objGear.Cost = "0";
objGear.Cost3 = "0";
objGear.Cost6 = "0";
objGear.Cost10 = "0";
}
objNode.Text = objGear.DisplayName;
int intCost = objGear.TotalCost;
// Multiply the cost if applicable.
if (objGear.TotalAvail().EndsWith(LanguageManager.Instance.GetString("String_AvailRestricted")) && _objOptions.MultiplyRestrictedCost)
intCost *= _objOptions.RestrictedCostMultiplier;
if (objGear.TotalAvail().EndsWith(LanguageManager.Instance.GetString("String_AvailForbidden")) && _objOptions.MultiplyForbiddenCost)
intCost *= _objOptions.ForbiddenCostMultiplier;
// Check the item's Cost and make sure the character can afford it.
if (!frmPickGear.FreeCost)
{
if (intCost > _objCharacter.Nuyen)
{
_objFunctions.DeleteGear(objGear, treWeapons, _objImprovementManager);
MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughNuyen"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughNuyen"), MessageBoxButtons.OK, MessageBoxIcon.Information);
if (frmPickGear.AddAgain)
tsVehicleSensorAddAsPlugin_Click(sender, e);
return;
}
else
{
// Create the Expense Log Entry.
ExpenseLogEntry objExpense = new ExpenseLogEntry();
objExpense.Create(intCost * -1, LanguageManager.Instance.GetString("String_ExpensePurchaseWeaponGear") + " " + objGear.DisplayNameShort, ExpenseType.Nuyen, DateTime.Now);
_objCharacter.ExpenseEntries.Add(objExpense);
_objCharacter.Nuyen -= intCost;
ExpenseUndo objUndo = new ExpenseUndo();
objUndo.CreateNuyen(NuyenExpenseType.AddWeaponGear, objGear.InternalId, frmPickGear.SelectedQty);
objExpense.Undo = objUndo;
}
}
objNode.ContextMenuStrip = cmsCyberwareGear;
treWeapons.SelectedNode.Nodes.Add(objNode);
treWeapons.SelectedNode.Expand();
objGear.Parent = objSensor;
objSensor.Children.Add(objGear);
if (frmPickGear.AddAgain)
tsWeaponAccessoryGearMenuAddAsPlugin_Click(sender, e);
UpdateCharacterInfo();
RefreshSelectedWeapon();
}
开发者ID:Althalusdlg, 项目名称:chummer5a, 代码行数:101, 代码来源:frmCareer.cs
示例9: tsWeaponAddAccessory_Click
//.........这里部分代码省略.........
frmPickWeaponAccessory.WeaponCost = objWeapon.Cost;
frmPickWeaponAccessory.AccessoryMultiplier = objWeapon.AccessoryMultiplier;
frmPickWeaponAccessory.ShowDialog();
if (frmPickWeaponAccessory.DialogResult == DialogResult.Cancel)
return;
// Locate the selected piece.
objXmlWeapon = objXmlDocument.SelectSingleNode("/chummer/accessories/accessory[name = \"" + frmPickWeaponAccessory.SelectedAccessory + "\"]");
TreeNode objNode = new TreeNode();
WeaponAccessory objAccessory = new WeaponAccessory(_objCharacter);
objAccessory.Create(objXmlWeapon, objNode, frmPickWeaponAccessory.SelectedMount);
objAccessory.Parent = objWeapon;
if (objAccessory.Cost.StartsWith("Variable"))
{
int intMin = 0;
int intMax = 0;
string strCost = objAccessory.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));
if (intMin != 0 || intMax != 0)
{
frmSelectNumber frmPickNumber = new frmSelectNumber();
if (intMax == 0)
intMax = 1000000;
frmPickNumber.Minimum = intMin;
frmPickNumber.Maximum = intMax;
frmPickNumber.Description = LanguageManager.Instance.GetString("String_SelectVariableCost").Replace("{0}", objAccessory.DisplayNameShort);
frmPickNumber.AllowCancel = false;
frmPickNumber.ShowDialog();
objAccessory.Cost = frmPickNumber.SelectedValue.ToString();
}
}
// Check the item's Cost and make sure the character can afford it.
int intOriginalCost = objWeapon.TotalCost;
objWeapon.WeaponAccessories.Add(objAccessory);
int intCost = objWeapon.TotalCost - intOriginalCost;
// Apply a markup if applicable.
if (frmPickWeaponAccessory.Markup != 0)
{
double dblCost = Convert.ToDouble(intCost, GlobalOptions.Instance.CultureInfo);
dblCost *= 1 + (Convert.ToDouble(frmPickWeaponAccessory.Markup, GlobalOptions.Instance.CultureInfo) / 100.0);
intCost = Convert.ToInt32(dblCost);
}
// Multiply the cost if applicable.
if (objAccessory.TotalAvail.EndsWith(LanguageManager.Instance.GetString("String_AvailRestricted")) && _objOptions.MultiplyRestrictedCost)
intCost *= _objOptions.RestrictedCostMultiplier;
if (objAccessory.TotalAvail.EndsWith(LanguageManager.Instance.GetString("String_AvailForbidden")) && _objOptions.MultiplyForbiddenCost)
intCost *= _objOptions.ForbiddenCostMultiplier;
if (!frmPickWeaponAccessory.FreeCost)
{
if (intCost > _objCharacter.Nuyen)
{
objWeapon.WeaponAccessories.Remove(objAccessory);
MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughNuyen"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughNuyen"), MessageBoxButtons.OK, MessageBoxIcon.Information);
if (frmPickWeaponAccessory.AddAgain)
tsWeaponAddAccessory_Click(sender, e);
return;
}
else
{
// Create the Expense Log Entry.
ExpenseLogEntry objExpense = new ExpenseLogEntry();
objExpense.Create(intCost * -1, LanguageManager.Instance.GetString("String_ExpensePurchaseWeaponAccessory") + " " + objAccessory.DisplayNameShort, ExpenseType.Nuyen, DateTime.Now);
_objCharacter.ExpenseEntries.Add(objExpense);
_objCharacter.Nuyen -= intCost;
ExpenseUndo objUndo = new ExpenseUndo();
objUndo.CreateNuyen(NuyenExpenseType.AddWeaponAccessory, objAccessory.InternalId);
objExpense.Undo = objUndo;
}
}
objNode.ContextMenuStrip = cmsWeaponAccessory;
treWeapons.SelectedNode.Nodes.Add(objNode);
treWeapons.SelectedNode.Expand();
UpdateCharacterInfo();
RefreshSelectedWeapon();
_blnIsDirty = true;
UpdateWindowTitle();
if (frmPickWeaponAccessory.AddAgain)
tsWeaponAddAccessory_Click(sender, e);
}
开发者ID:Althalusdlg, 项目名称:chummer5a, 代码行数:101, 代码来源:frmCareer.cs
示例10: tsVehicleAddNexus_Click
private void tsVehicleAddNexus_Click(object sender, EventArgs e)
{
// Make sure a parent items is selected, then open the Select Gear window.
try
{
if (treVehicles.SelectedNode.Level == 0)
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_SelectGearVehicle"), LanguageManager.Instance.GetString("MessageTitle_SelectGearVehicle"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
}
catch
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_SelectGearVehicle"), LanguageManager.Instance.GetString("MessageTitle_SelectGearVehicle"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (treVehicles.SelectedNode.Level > 1)
treVehicles.SelectedNode = treVehicles.SelectedNode.Parent;
// Attempt to locate the selected Vehicle.
Vehicle objSelectedVehicle = _objFunctions.FindVehicle(treVehicles.SelectedNode.Tag.ToString(), _objCharacter.Vehicles);
frmSelectNexus frmPickNexus = new frmSelectNexus(_objCharacter, true);
frmPickNexus.ShowDialog(this);
if (frmPickNexus.DialogResult == DialogResult.Cancel)
return;
Gear objGear = new Gear(_objCharacter);
objGear = frmPickNexus.SelectedNexus;
int intCost = objGear.TotalCost;
// Multiply the cost if applicable.
if (objGear.TotalAvail().EndsWith(LanguageManager.Instance.GetString("String_AvailRestricted")) && _objOptions.MultiplyRestrictedCost)
intCost *= _objOptions.RestrictedCostMultiplier;
if (objGear.TotalAvail().EndsWith(LanguageManager.Instance.GetString("String_AvailForbidden")) && _objOptions.MultiplyForbiddenCost)
intCost *= _objOptions.ForbiddenCostMultiplier;
// Check the item's Cost and make sure the character can afford it.
if (!frmPickNexus.FreeCost)
{
if (intCost > _objCharacter.Nuyen)
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughNuyen"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughNuyen"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
else
{
// Create the Expense Log Entry.
ExpenseLogEntry objExpense = new ExpenseLogEntry();
objExpense.Create(intCost * -1, LanguageManager.Instance.GetString("String_ExpensePurchaseVehicleGear") + " " + objGear.DisplayNameShort, ExpenseType.Nuyen, DateTime.Now);
_objCharacter.ExpenseEntries.Add(objExpense);
_objCharacter.Nuyen -= intCost;
ExpenseUndo objUndo = new ExpenseUndo();
objUndo.CreateNuyen(NuyenExpenseType.AddVehicleGear, objGear.InternalId, 1);
objExpense.Undo = objUndo;
}
}
TreeNode nodNexus = new TreeNode();
nodNexus.Text = objGear.Name;
nodNexus.Tag = objGear.InternalId;
nodNexus.ContextMenuStrip = cmsVehicleGear;
foreach (Gear objChild in objGear.Children)
{
TreeNode nodModule = new TreeNode();
nodModule.Text = objChild.Name;
nodModule.Tag = objChild.InternalId;
nodModule.ContextMenuStrip = cmsVehicleGear;
nodNexus.Nodes.Add(nodModule);
nodNexus.Expand();
}
treVehicles.SelectedNode.Nodes.Add(nodNexus);
treVehicles.SelectedNode.Expand();
objSelectedVehicle.Gear.Add(objGear);
UpdateCharacterInfo();
RefreshSelectedVehicle();
_blnIsDirty = true;
UpdateWindowTitle();
}
开发者ID:Althalusdlg, 项目名称:chummer5a, 代码行数:88, 代码来源:frmCareer.cs
示例11: tsVehicleAddWeaponAccessory_Click
//.........这里部分代码省略.........
MessageBox.Show(LanguageManager.Instance.GetString("Message_CannotModifyWeapon"), LanguageManager.Instance.GetString("MessageTitle_CannotModifyWeapon"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
// Make sure the Weapon allows Accessories to be added to it.
if (!Convert.ToBoolean(objXmlWeapon["allowaccessory"].InnerText))
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_CannotModifyWeapon"), LanguageManager.Instance.GetString("MessageTitle_CannotModifyWeapon"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
else
{
XmlNodeList objXmlMountList = objXmlWeapon.SelectNodes("accessorymounts/mount");
string strMounts = "";
foreach (XmlNode objXmlMount in objXmlMountList)
{
// Run through the Weapon's currenct Accessories and filter out any used up Mount points.
bool blnFound = false;
foreach (WeaponAccessory objCurrentAccessory in objWeapon.WeaponAccessories)
{
if (objCurrentAccessory.Mount == objXmlMount.InnerText)
blnFound = true;
}
if (!blnFound)
strMounts += objXmlMount.InnerText + "/";
}
frmPickWeaponAccessory.AllowedMounts = strMounts;
}
frmPickWeaponAccessory.WeaponCost = objWeapon.Cost;
frmPickWeaponAccessory.AccessoryMultiplier = objWeapon.AccessoryMultiplier;
frmPickWeaponAccessory.ShowDialog();
if (frmPickWeaponAccessory.DialogResult == DialogResult.Cancel)
return;
// Locate the selected piece.
objXmlWeapon = objXmlDocument.SelectSingleNode("/chummer/accessories/accessory[name = \"" + frmPickWeaponAccessory.SelectedAccessory + "\"]");
TreeNode objNode = new TreeNode();
WeaponAccessory objAccessory = new WeaponAccessory(_objCharacter);
objAccessory.Create(objXmlWeapon, objNode, frmPickWeaponAccessory.SelectedMount);
objAccessory.Parent = objWeapon;
// Check the item's Cost and make sure the character can afford it.
int intOriginalCost = objWeapon.TotalCost;
objWeapon.WeaponAccessories.Add(objAccessory);
int intCost = objWeapon.TotalCost - intOriginalCost;
// Apply a markup if applicable.
if (frmPickWeaponAccessory.Markup != 0)
{
double dblCost = Convert.ToDouble(intCost, GlobalOptions.Instance.CultureInfo);
dblCost *= 1 + (Convert.ToDouble(frmPickWeaponAccessory.Markup, GlobalOptions.Instance.CultureInfo) / 100.0);
intCost = Convert.ToInt32(dblCost);
}
// Multiply the cost if applicable.
if (objAccessory.TotalAvail.EndsWith(LanguageManager.Instance.GetString("String_AvailRestricted")) && _objOptions.MultiplyRestrictedCost)
intCost *= _objOptions.RestrictedCostMultiplier;
if (objAccessory.TotalAvail.EndsWith(LanguageManager.Instance.GetString("String_AvailForbidden")) && _objOptions.MultiplyForbiddenCost)
intCost *= _objOptions.ForbiddenCostMultiplier;
if (!frmPickWeaponAccessory.FreeCost)
{
if (intCost > _objCharacter.Nuyen)
{
objWeapon.WeaponAccessories.Remove(objAccessory);
MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughNuyen"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughNuyen"), MessageBoxButtons.OK, MessageBoxIcon.Information);
if (frmPickWeaponAccessory.AddAgain)
tsVehicleAddWeaponAccessory_Click(sender, e);
return;
}
else
{
// Create the Expense Log Entry.
ExpenseLogEntry objExpense = new ExpenseLogEntry();
objExpense.Create(intCost * -1, LanguageManager.Instance.GetString("String_ExpensePurchaseVehicleWeaponAccessory") + " " + objAccessory.DisplayNameShort, ExpenseType.Nuyen, DateTime.Now);
_objCharacter.ExpenseEntries.Add(objExpense);
_objCharacter.Nuyen -= intCost;
ExpenseUndo objUndo = new ExpenseUndo();
objUndo.CreateNuyen(NuyenExpenseType.AddVehicleWeaponAccessory, objAccessory.InternalId);
objExpense.Undo = objUndo;
}
}
objNode.ContextMenuStrip = cmsVehicleWeaponAccessory;
treVehicles.SelectedNode.Nodes.Add(objNode);
treVehicles.SelectedNode.Expand();
if (frmPickWeaponAccessory.AddAgain)
tsVehicleAddWeaponAccessory_Click(sender, e);
UpdateCharacterInfo();
_blnIsDirty = true;
UpdateWindowTitle();
}
开发者ID:Althalusdlg, 项目名称:chummer5a, 代码行数:101, 代码来源:frmCareer.cs
示例12: tsVehicleAddMod_Click
//.........这里部分代码省略.........
XmlDocument objXmlDocument = XmlManager.Instance.Load("vehicles.xml");
XmlNode objXmlMod = objXmlDocument.SelectSingleNode("/chummer/mods/mod[name = \"" + frmPickVehicleMod.SelectedMod + "\"]");
TreeNode objNode = new TreeNode();
VehicleMod objMod = new VehicleMod(_objCharacter);
objMod.Create(objXmlMod, objNode, frmPickVehicleMod.SelectedRating);
// Make sure that the Armor Rating does not exceed the maximum allowed by the Vehicle.
if (objMod.Name.StartsWith("Armor"))
{
if (objMod.Rating > objSelectedVehicle.MaxArmor)
{
objMod.Rating = objSelectedVehicle.MaxArmor;
objNode.Text = objMod.DisplayName;
}
}
// Check the item's Cost and make sure the character can afford it.
int intOriginalCost = objSelectedVehicle.TotalCost;
objSelectedVehicle.Mods.Add(objMod);
// Do not allow the user to add a new Vehicle Mod if the Vehicle's Capacity has been reached.
if (_objOptions.EnforceCapacity && objSelectedVehicle.Slots < objSelectedVehicle.SlotsUsed)
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_CapacityReached"), LanguageManager.Instance.GetString("MessageTitle_CapacityReached"), MessageBoxButtons.OK, MessageBoxIcon.Information);
objSelectedVehicle.Mods.Remove(objMod);
if (frmPickVehicleMod.AddAgain)
tsVehicleAddMod_Click(sender, e);
return;
}
int intCost = objSelectedVehicle.TotalCost - intOriginalCost;
// Apply a markup if applicable.
if (frmPickVehicleMod.Markup != 0)
{
double dblCost = Convert.ToDouble(intCost, GlobalOptions.Instance.CultureInfo);
dblCost *= 1 + (Convert.ToDouble(frmPickVehicleMod.Markup, GlobalOptions.Instance.CultureInfo) / 100.0);
intCost = Convert.ToInt32(dblCost);
}
// Multiply the cost if applicable.
if (objMod.TotalAvail.EndsWith(LanguageManager.Instance.GetString("String_AvailRestricted")) && _objOptions.MultiplyRestrictedCost)
intCost *= _objOptions.RestrictedCostMultiplier;
if (objMod.TotalAvail.EndsWith(LanguageManager.Instance.GetString("String_AvailForbidden")) && _objOptions.MultiplyForbiddenCost)
intCost *= _objOptions.ForbiddenCostMultiplier;
if (!frmPickVehicleMod.FreeCost)
{
if (intCost > _objCharacter.Nuyen)
{
objSelectedVehicle.Mods.Remove(objMod);
MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughNuyen"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughNuyen"), MessageBoxButtons.OK, MessageBoxIcon.Information);
if (frmPickVehicleMod.AddAgain)
tsVehicleAddMod_Click(sender, e);
return;
}
else
{
// Create the Expense Log Entry.
ExpenseLogEntry objExpense = new ExpenseLogEntry();
objExpense.Create(intCost * -1, LanguageManager.Instance.GetString("String_ExpensePurchaseVehicleMod") + " " + objMod.DisplayNameShort, ExpenseType.Nuyen, DateTime.Now);
_objCharacter.ExpenseEntries.Add(objExpense);
_objCharacter.Nuyen -= intCost;
ExpenseUndo objUndo = new ExpenseUndo();
objUndo.CreateNuyen(NuyenExpenseType.AddVehicleMod, objMod.InternalId);
objExpense.Undo = objUndo;
}
}
objNode.ContextMenuStrip = cmsVehicle;
treVehicles.SelectedNode.Nodes.Add(objNode);
treVehicles.SelectedNode.Expand();
RefreshSelectedVehicle();
// Check for Improved Sensor bonus.
if (objMod.Bonus != null)
{
if (objMod.Bonus["selecttext"] != null)
{
frmSelectText frmPickText = new frmSelectText();
frmPickText.Description = LanguageManager.Instance.GetString("String_Improvement_SelectText").Replace("{0}", objMod.DisplayNameShort);
frmPickText.ShowDialog(this);
objMod.Extra = frmPickText.SelectedValue;
objNode.Text = objMod.DisplayName;
}
if (objMod.Bonus["improvesensor"] != null)
{
ChangeVehicleSensor(objSelectedVehicle, true);
}
}
_blnIsDirty = true;
UpdateWindowTitle();
if (frmPickVehicleMod.AddAgain)
tsVehicleAddMod_Click(sender, e);
}
开发者ID:Althalusdlg, 项目名称:chummer5a, 代码行数:101, 代码来源:frmCareer.cs
示例13: tsVehicleAddGear_Click
//.........这里部分代码省略.........
// If the item was marked as free, change its cost.
if (frmPickGear.FreeCost)
{
objGear.Cost = "0";
objGear.Cost3 = "0";
objGear.Cost6 = "0";
objGear.Cost10 = "0";
}
objGear.Quantity = frmPickGear.SelectedQty;
objNode.Text = objGear.DisplayName;
// Change the cost of the Sensor itself to 0.
//if (frmPickGear.SelectedCategory == "Sensors")
//{
// objGear.Cost = "0";
// objGear.Cost3 = "0";
// objGear.Cost6 = "0";
// objGear.Cost10 = "0";
//}
int intCost = objGear.TotalCost;
// Multiply the cost if applicable.
if (objGear.TotalAvail().EndsWith(LanguageManager.Instance.GetString("String_AvailRestricted")) && _objOptions.MultiplyRestrictedCost)
intCost *= _objOptions.RestrictedCostMultiplier;
if (objGear.TotalAvail().EndsWith(LanguageManager.Instance.GetString("String_AvailForbidden")) && _objOptions.MultiplyForbiddenCost)
intCost *= _objOptions.ForbiddenCostMultiplier;
// Check the item's Cost and make sure the character can afford it.
if (!frmPickGear.FreeCost)
{
if (intCost > _objCharacter.Nuyen)
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughNuyen"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughNuyen"), MessageBoxButtons.OK, MessageBoxIcon.Information);
if (frmPickGear.AddAgain)
tsVehicleAddGear_Click(sender, e);
return;
}
else
{
// Create the Expense Log Entry.
ExpenseLogEntry objExpense = new ExpenseLogEntry();
objExpense.Create(intCost * -1, LanguageManager.Instance.GetString("String_ExpensePurchaseVehicleGear") + " " + objGear.DisplayNameShort, ExpenseType.Nuyen, DateTime.Now);
_objCharacter.ExpenseEntries.Add(objExpense);
_objCharacter.Nuyen -= intCost;
ExpenseUndo objUndo = new ExpenseUndo();
objUndo.CreateNuyen(NuyenExpenseType.AddVehicleGear, objGear.InternalId, 1);
objExpense.Undo = objUndo;
}
}
objNode.ContextMenuStrip = cmsVehicleGear;
bool blnMatchFound = false;
// If this is Ammunition, see if the character already has it on them.
if (objGear.Category == "Ammunition")
{
foreach (Gear objVehicleGear in objSelectedVehicle.Gear)
{
if (objVehicleGear.Name == objGear.Name && objVehicleGear.Category == objGear.Category && objVehicleGear.Rating == objGear.Rating && objVehicleGear.Extra == objGear.Extra)
{
// A match was found, so increase the quantity instead.
objVehicleGear.Quantity += objGear.Quantity;
blnMatchFound = true;
foreach (TreeNode objGearNode in treVehicles.SelectedNode.Nodes)
{
if (objVehicleGear.InternalId == objGearNode.Tag.ToString())
{
objGearNode.Text = objVehicleGear.DisplayName;
break;
}
}
break;
}
}
}
if (!blnMatchFound)
{
treVehicles.SelectedNode.Nodes.Add(objNode);
treVehicles.SelectedNode.Expand();
// Add the Gear to the Vehicle.
objSelectedVehicle.Gear.Add(objGear);
}
if (frmPickGear.AddAgain)
tsVehicleAddGear_Click(sender, e);
UpdateCharacterInfo();
RefreshSelectedVehicle();
_blnIsDirty = true;
UpdateWindowTitle();
}
开发者ID:Althalusdlg, 项目名称:chummer5a, 代码行数:101, 代码来源:frmCareer.cs
示例14: tsVehicleAddCyberware_Click
六六分期app的软件客服如何联系?不知道吗?加qq群【895510560】即可!标题:六六分期
阅读:18210| 2023-10-27
今天小编告诉大家如何处理win10系统火狐flash插件总是崩溃的问题,可能很多用户都不知
阅读:9656| 2022-11-06
今天小编告诉大家如何对win10系统删除桌面回收站图标进行设置,可能很多用户都不知道
阅读:8168| 2022-11-06
今天小编告诉大家如何对win10系统电脑设置节能降温的设置方法,想必大家都遇到过需要
阅读:8543| 2022-11-06
我们在使用xp系统的过程中,经常需要对xp系统无线网络安装向导设置进行设置,可能很多
阅读:8449| 2022-11-06
今天小编告诉大家如何处理win7系统玩cf老是与主机连接不稳定的问题,可能很多用户都不
阅读:9375| 2022-11-06
电脑对日常生活的重要性小编就不多说了,可是一旦碰到win7系统设置cf烟雾头的问题,很
阅读:8418| 2022-11-06
我们在日常使用电脑的时候,有的小伙伴们可能在打开应用的时候会遇见提示应用程序无法
阅读:7855| 2022-11-06
今天小编告诉大家如何对win7系统打开vcf文件进行设置,可能很多用户都不知道怎么对win
阅读:8403| 2022-11-06
今天小编告诉大家如何对win10系统s4开启USB调试模式进行设置,可能很多用户都不知道怎
阅读:7391| 2022-11-06
请发表评论