本文整理汇总了C#中Chummer.frmSelectText类的典型用法代码示例。如果您正苦于以下问题:C# frmSelectText类的具体用法?C# frmSelectText怎么用?C# frmSelectText使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
frmSelectText类属于Chummer命名空间,在下文中一共展示了frmSelectText类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: tsVehicleAddMod_Click
private void tsVehicleAddMod_Click(object sender, EventArgs e)
{
// Make sure a parent items is selected, then open the Select Vehicle Mod window.
try
{
if (treVehicles.SelectedNode.Level == 0)
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_SelectVehicle"), LanguageManager.Instance.GetString("MessageTitle_SelectVehicle"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
}
catch
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_SelectVehicle"), LanguageManager.Instance.GetString("MessageTitle_SelectVehicle"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (treVehicles.SelectedNode.Level > 1)
treVehicles.SelectedNode = treVehicles.SelectedNode.Parent;
Vehicle objSelectedVehicle = _objFunctions.FindVehicle(treVehicles.SelectedNode.Tag.ToString(), _objCharacter.Vehicles);
frmSelectVehicleMod frmPickVehicleMod = new frmSelectVehicleMod(_objCharacter);
// Set the Vehicle properties for the window.
frmPickVehicleMod.VehicleCost = Convert.ToInt32(objSelectedVehicle.Cost);
frmPickVehicleMod.Body = objSelectedVehicle.TotalBody;
frmPickVehicleMod.Seats = objSelectedVehicle.Seats;
frmPickVehicleMod.Handling = objSelectedVehicle.Handling;
frmPickVehicleMod.Speed = objSelectedVehicle.Speed;
frmPickVehicleMod.Accel = objSelectedVehicle.Accel;
frmPickVehicleMod.DeviceRating = objSelectedVehicle.DeviceRating;
frmPickVehicleMod.HasModularElectronics = objSelectedVehicle.HasModularElectronics();
frmPickVehicleMod.ShowDialog(this);
// Make sure the dialogue window was not canceled.
if (frmPickVehicleMod.DialogResult == DialogResult.Cancel)
return;
// Open the Vehicles XML file and locate the selected piece.
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;
}
}
objSelectedVehicle.Mods.Add(objMod);
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:cormanater,项目名称:chummer5a,代码行数:88,代码来源:frmCreate.cs
示例2: cmdAddArmorBundle_Click
private void cmdAddArmorBundle_Click(object sender, EventArgs e)
{
// Add a new location to the Armor Tree.
frmSelectText frmPickText = new frmSelectText();
frmPickText.Description = LanguageManager.Instance.GetString("String_AddLocation");
frmPickText.ShowDialog(this);
if (frmPickText.DialogResult == DialogResult.Cancel || frmPickText.SelectedValue == "")
return;
string strLocation = frmPickText.SelectedValue;
_objCharacter.ArmorBundles.Add(strLocation);
TreeNode objLocation = new TreeNode();
objLocation.Tag = strLocation;
objLocation.Text = strLocation;
objLocation.ContextMenuStrip = cmsArmorLocation;
treArmor.Nodes.Add(objLocation);
_blnIsDirty = true;
UpdateWindowTitle();
}
开发者ID:cormanater,项目名称:chummer5a,代码行数:22,代码来源:frmCreate.cs
示例3: cmdAddVehicleLocation_Click
private void cmdAddVehicleLocation_Click(object sender, EventArgs e)
{
// Make sure a Vehicle is selected.
Vehicle objVehicle = new Vehicle(_objCharacter);
try
{
if (treVehicles.SelectedNode.Level == 1)
{
objVehicle = _objFunctions.FindVehicle(treVehicles.SelectedNode.Tag.ToString(), _objCharacter.Vehicles);
}
else
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_SelectVehicleLocation"), LanguageManager.Instance.GetString("MessageTitle_SelectVehicle"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
}
catch
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_SelectVehicleLocation"), LanguageManager.Instance.GetString("MessageTitle_SelectVehicle"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
// Add a new location to the selected Vehicle.
frmSelectText frmPickText = new frmSelectText();
frmPickText.Description = LanguageManager.Instance.GetString("String_AddLocation");
frmPickText.ShowDialog(this);
if (frmPickText.DialogResult == DialogResult.Cancel || frmPickText.SelectedValue == "")
return;
string strLocation = frmPickText.SelectedValue;
objVehicle.Locations.Add(strLocation);
TreeNode objLocation = new TreeNode();
objLocation.Tag = strLocation;
objLocation.Text = strLocation;
objLocation.ContextMenuStrip = cmsVehicleLocation;
treVehicles.SelectedNode.Nodes.Add(objLocation);
_blnIsDirty = true;
UpdateWindowTitle();
}
开发者ID:cormanater,项目名称:chummer5a,代码行数:42,代码来源:frmCreate.cs
示例4: tsVehicleRenameLocation_Click
private void tsVehicleRenameLocation_Click(object sender, EventArgs e)
{
string strNewLocation = "";
frmSelectText frmPickText = new frmSelectText();
frmPickText.Description = LanguageManager.Instance.GetString("String_AddLocation");
frmPickText.ShowDialog(this);
if (frmPickText.DialogResult == DialogResult.Cancel)
return;
// Determine if this is a Location.
TreeNode objVehicleNode = treVehicles.SelectedNode;
do
{
objVehicleNode = objVehicleNode.Parent;
} while (objVehicleNode.Level > 1);
// Get a reference to the affected Vehicle.
Vehicle objVehicle = new Vehicle(_objCharacter);
foreach (Vehicle objCharacterVehicle in _objCharacter.Vehicles)
{
if (objCharacterVehicle.InternalId == objVehicleNode.Tag.ToString())
{
objVehicle = objCharacterVehicle;
break;
}
}
strNewLocation = frmPickText.SelectedValue;
int i = -1;
foreach (string strLocation in objVehicle.Locations)
{
i++;
if (strLocation == treVehicles.SelectedNode.Text)
{
foreach (Gear objGear in objVehicle.Gear)
{
if (objGear.Location == strLocation)
objGear.Location = strNewLocation;
}
objVehicle.Locations[i] = strNewLocation;
treVehicles.SelectedNode.Text = strNewLocation;
break;
}
}
}
开发者ID:cormanater,项目名称:chummer5a,代码行数:48,代码来源:frmCreate.cs
示例5: cmdAddComplexForm_Click
private void cmdAddComplexForm_Click(object sender, EventArgs e)
{
if (_objCharacter.BuildMethod == CharacterBuildMethod.Priority || _objCharacter.BuildMethod == CharacterBuildMethod.SumtoTen)
{
// The number of Complex Form Points cannot exceed the priority limit.
int intCFP = 0;
foreach (ComplexForm tp in _objCharacter.ComplexForms)
{
intCFP++;
}
}
else
{
// The number of Complex Forms cannot exceed twice the character's LOG.
if (_objCharacter.ComplexForms.Count >= ((_objCharacter.LOG.Value * 2) + _objImprovementManager.ValueOf(Improvement.ImprovementType.ComplexFormLimit)) && !_objCharacter.IgnoreRules)
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_ComplexFormLimit"), LanguageManager.Instance.GetString("MessageTitle_ComplexFormLimit"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
}
// Let the user select a Program.
frmSelectProgram frmPickProgram = new frmSelectProgram(_objCharacter);
frmPickProgram.ShowDialog(this);
// Make sure the dialogue window was not canceled.
if (frmPickProgram.DialogResult == DialogResult.Cancel)
return;
XmlDocument objXmlDocument = XmlManager.Instance.Load("complexforms.xml");
XmlNode objXmlProgram = objXmlDocument.SelectSingleNode("/chummer/complexforms/complexform[name = \"" + frmPickProgram.SelectedProgram + "\"]");
// Check for SelectText.
string strExtra = "";
if (objXmlProgram["bonus"] != null)
{
if (objXmlProgram["bonus"]["selecttext"] != null)
{
frmSelectText frmPickText = new frmSelectText();
frmPickText.Description = LanguageManager.Instance.GetString("String_Improvement_SelectText").Replace("{0}", frmPickProgram.SelectedProgram);
frmPickText.ShowDialog(this);
strExtra = frmPickText.SelectedValue;
}
}
TreeNode objNode = new TreeNode();
ComplexForm objProgram = new ComplexForm(_objCharacter);
objProgram.Create(objXmlProgram, _objCharacter, objNode, strExtra);
if (objProgram.InternalId == Guid.Empty.ToString())
return;
_objCharacter.ComplexForms.Add(objProgram);
treComplexForms.Nodes[0].Nodes.Add(objNode);
treComplexForms.Nodes[0].Expand();
treComplexForms.SortCustom();
UpdateCharacterInfo();
_blnIsDirty = true;
UpdateWindowTitle();
int intComplexForms = 0;
foreach (ComplexForm tp in _objCharacter.ComplexForms)
{
intComplexForms++;
}
//if (_objCharacter.CFPLimit - intComplexForms < 0)
// lblPBuildComplexForms.Text = String.Format("{0} " + LanguageManager.Instance.GetString("String_Of") + " {1}", (0).ToString(), _objCharacter.CFPLimit.ToString());
//else
lblPBuildComplexForms.Text = String.Format("{0} " + LanguageManager.Instance.GetString("String_Of") + " {1}", (_objCharacter.CFPLimit - intComplexForms).ToString(), _objCharacter.CFPLimit.ToString());
if (frmPickProgram.AddAgain)
cmdAddComplexForm_Click(sender, e);
}
开发者ID:cormanater,项目名称:chummer5a,代码行数:76,代码来源:frmCreate.cs
示例6: CreateImprovements
/// <summary>
/// Create all of the Improvements for an XML Node.
/// </summary>
/// <param name="objImprovementSource">Type of object that grants these Improvements.</param>
/// <param name="strSourceName">Name of the item that grants these Improvements.</param>
/// <param name="nodBonus">bonus XMLXode from the source data file.</param>
/// <param name="blnConcatSelectedValue">Whether or not any selected values should be concatinated with the SourceName string when storing.</param>
/// <param name="intRating">Selected Rating value that is used to replace the Rating string in an Improvement.</param>
/// <param name="strFriendlyName">Friendly name to show in any dialogue windows that ask for a value.</param>
public bool CreateImprovements(Improvement.ImprovementSource objImprovementSource, string strSourceName, XmlNode nodBonus, bool blnConcatSelectedValue = false, int intRating = 1, string strFriendlyName = "", bool blnConditional = false)
{
if (nodBonus == null)
{
_strForcedValue = "";
_strLimitSelection = "";
return true;
}
if (blnConditional)
{
_objCharacter.ImprovementGroups.Add(strSourceName);
}
string strUnique = "";
if (nodBonus.Attributes["unique"] != null)
strUnique = nodBonus.Attributes["unique"].InnerText;
bool blnSuccess = true;
_strSelectedValue = "";
// If no friendly name was provided, use the one from SourceName.
if (strFriendlyName == "")
strFriendlyName = strSourceName;
if (nodBonus.HasChildNodes)
{
// Select Text (custom entry for things like Allergy).
if (NodeExists(nodBonus, "selecttext"))
{
if (_strForcedValue != "")
_strLimitSelection = _strForcedValue;
// Display the Select Text window and record the value that was entered.
frmSelectText frmPickText = new frmSelectText();
frmPickText.Description = LanguageManager.Instance.GetString("String_Improvement_SelectText").Replace("{0}", strFriendlyName);
if (_strLimitSelection != "")
{
frmPickText.SelectedValue = _strLimitSelection;
frmPickText.Opacity = 0;
}
frmPickText.ShowDialog();
// Make sure the dialogue window was not canceled.
if (frmPickText.DialogResult == DialogResult.Cancel)
{
Rollback();
blnSuccess = false;
_strForcedValue = "";
_strLimitSelection = "";
return false;
}
_strSelectedValue = frmPickText.SelectedValue;
if (blnConcatSelectedValue)
strSourceName += " (" + _strSelectedValue + ")";
// Create the Improvement.
CreateImprovement(frmPickText.SelectedValue, objImprovementSource, strSourceName, Improvement.ImprovementType.Text, strUnique, blnConditional);
}
}
// If there is no character object, don't attempt to add any Improvements.
if (_objCharacter == null)
return true;
// Check to see what bonuses the node grants.
if (nodBonus.HasChildNodes)
{
// Add an Attribute.
if (NodeExists(nodBonus, "addattribute"))
{
if (nodBonus["addattribute"]["name"].InnerText == "MAG")
{
_objCharacter.MAGEnabled = true;
CreateImprovement("MAG", objImprovementSource, strSourceName, Improvement.ImprovementType.Attribute, "enableattribute", blnConditional, 0, 0);
if (nodBonus["addattribute"]["min"] != null)
_objCharacter.MAG.MetatypeMinimum = Convert.ToInt32(nodBonus["addattribute"]["min"].InnerText);
if (nodBonus["addattribute"]["max"] != null)
_objCharacter.MAG.MetatypeMaximum = Convert.ToInt32(nodBonus["addattribute"]["max"].InnerText);
if (nodBonus["addattribute"]["aug"] != null)
_objCharacter.MAG.MetatypeAugmentedMaximum = Convert.ToInt32(nodBonus["addattribute"]["aug"].InnerText);
if (nodBonus["addattribute"]["val"] != null)
_objCharacter.MAG.Value = Convert.ToInt32(nodBonus["addattribute"]["val"].InnerText);
}
else if (nodBonus["addattribute"]["name"].InnerText == "RES")
{
_objCharacter.RESEnabled = true;
CreateImprovement("RES", objImprovementSource, strSourceName, Improvement.ImprovementType.Attribute, "enableattribute", blnConditional, 0, 0);
//.........这里部分代码省略.........
开发者ID:janhelke,项目名称:chummer2,代码行数:101,代码来源:clsImprovement.cs
示例7: tsArmorRenameLocation_Click
private void tsArmorRenameLocation_Click(object sender, EventArgs e)
{
string strNewLocation = "";
frmSelectText frmPickText = new frmSelectText();
frmPickText.Description = LanguageManager.Instance.GetString("String_AddLocation");
frmPickText.ShowDialog(this);
if (frmPickText.DialogResult == DialogResult.Cancel)
return;
strNewLocation = frmPickText.SelectedValue;
int i = -1;
foreach (string strLocation in _objCharacter.ArmorBundles)
{
i++;
if (strLocation == treArmor.SelectedNode.Text)
{
foreach (Armor objArmor in _objCharacter.Armor)
{
if (objArmor.Location == strLocation)
objArmor.Location = strNewLocation;
}
_objCharacter.ArmorBundles[i] = strNewLocation;
treArmor.SelectedNode.Text = strNewLocation;
break;
}
}
}
开发者ID:cormanater,项目名称:chummer5a,代码行数:30,代码来源:frmCreate.cs
示例8: tsVehicleName_Click
private void tsVehicleName_Click(object sender, EventArgs e)
{
// Make sure a parent item is selected.
try
{
if (treVehicles.SelectedNode.Level == 0)
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_SelectVehicleName"), LanguageManager.Instance.GetString("MessageTitle_SelectVehicle"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
}
catch
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_SelectVehicleName"), LanguageManager.Instance.GetString("MessageTitle_SelectVehicle"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
while (treVehicles.SelectedNode.Level > 1)
{
treVehicles.SelectedNode = treVehicles.SelectedNode.Parent;
}
// Get the information for the currently selected Vehicle.
Vehicle objVehicle = _objFunctions.FindVehicle(treVehicles.SelectedNode.Tag.ToString(), _objCharacter.Vehicles);
frmSelectText frmPickText = new frmSelectText();
frmPickText.Description = LanguageManager.Instance.GetString("String_VehicleName");
frmPickText.ShowDialog(this);
if (frmPickText.DialogResult == DialogResult.Cancel)
return;
objVehicle.VehicleName = frmPickText.SelectedValue;
treVehicles.SelectedNode.Text = objVehicle.DisplayName;
}
开发者ID:cormanater,项目名称:chummer5a,代码行数:35,代码来源:frmCreate.cs
示例9: tsLifestyleName_Click
private void tsLifestyleName_Click(object sender, EventArgs e)
{
try
{
if (treLifestyles.SelectedNode.Level == 0)
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_SelectLifestyleName"), LanguageManager.Instance.GetString("MessageTitle_SelectLifestyle"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
}
catch
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_SelectLifestyleName"), LanguageManager.Instance.GetString("MessageTitle_SelectLifestyle"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
// Get the information for the currently selected Lifestyle.
Lifestyle objLifestyle = new Lifestyle(_objCharacter);
foreach (Lifestyle objSelectedLifestyle in _objCharacter.Lifestyles)
{
if (objSelectedLifestyle.InternalId == treLifestyles.SelectedNode.Tag.ToString())
{
objLifestyle = objSelectedLifestyle;
break;
}
}
frmSelectText frmPickText = new frmSelectText();
frmPickText.Description = LanguageManager.Instance.GetString("String_LifestyleName");
frmPickText.ShowDialog(this);
if (frmPickText.DialogResult == DialogResult.Cancel)
return;
objLifestyle.LifestyleName = frmPickText.SelectedValue;
treLifestyles.SelectedNode.Text = objLifestyle.DisplayName;
}
开发者ID:cormanater,项目名称:chummer5a,代码行数:37,代码来源:frmCreate.cs
示例10: ProcessBonus
//.........这里部分代码省略.........
_strForcedValue = "";
Log.Info("_strForcedValue = " + _strForcedValue);
Log.Info("_strLimitSelection = " + _strLimitSelection);
if (_strForcedValue != "")
{
frmPickSkill.OnlySkill = _strForcedValue;
frmPickSkill.Opacity = 0;
}
frmPickSkill.ShowDialog();
// Make sure the dialogue window was not canceled.
if (frmPickSkill.DialogResult == DialogResult.Cancel)
{
Rollback();
_strForcedValue = "";
_strLimitSelection = "";
return false;
}
_strSelectedValue = frmPickSkill.SelectedSkill;
_strForcedValue = _strSelectedValue;
strSelection = _strSelectedValue;
Log.Info("_strForcedValue = " + _strForcedValue);
Log.Info("_strSelectedValue = " + _strSelectedValue);
Log.Info("strSelection = " + strSelection);
}
if (bonusNode["selecttext"] != null)
{
Log.Info("selecttext = " + bonusNode["selecttext"].OuterXml.ToString());
frmSelectText frmPickText = new frmSelectText();
if (_objCharacter.Pushtext.Count > 0)
{
strSelection = _objCharacter.Pushtext.Pop();
}
else
{
frmPickText.Description = LanguageManager.Instance.GetString("String_Improvement_SelectText")
.Replace("{0}", strFriendlyName);
Log.Info("_strForcedValue = " + _strForcedValue);
Log.Info("_strLimitSelection = " + _strLimitSelection);
if (_strLimitSelection != "")
{
frmPickText.SelectedValue = _strLimitSelection;
frmPickText.Opacity = 0;
}
frmPickText.ShowDialog();
// Make sure the dialogue window was not canceled.
if (frmPickText.DialogResult == DialogResult.Cancel)
{
Rollback();
_strForcedValue = "";
_strLimitSelection = "";
return false;
}
strSelection = frmPickText.SelectedValue;
_strLimitSelection = strSelection;
开发者ID:Rockzo,项目名称:chummer5a,代码行数:67,代码来源:clsImprovement.cs
示例11: CreateImprovements
/// <summary>
/// Create all of the Improvements for an XML Node.
/// </summary>
/// <param name="objImprovementSource">Type of object that grants these Improvements.</param>
/// <param name="strSourceName">Name of the item that grants these Improvements.</param>
/// <param name="nodBonus">bonus XMLXode from the source data file.</param>
/// <param name="blnConcatSelectedValue">Whether or not any selected values should be concatinated with the SourceName string when storing.</param>
/// <param name="intRating">Selected Rating value that is used to replace the Rating string in an Improvement.</param>
/// <param name="strFriendlyName">Friendly name to show in any dialogue windows that ask for a value.</param>
/// <returns>True if successfull</returns>
public bool CreateImprovements(Improvement.ImprovementSource objImprovementSource, string strSourceName,
XmlNode nodBonus, bool blnConcatSelectedValue = false, int intRating = 1, string strFriendlyName = "",
object fCreate = null)
{
Log.Enter("CreateImprovements");
Log.Info("objImprovementSource = " + objImprovementSource.ToString());
Log.Info("strSourceName = " + strSourceName);
Log.Info("nodBonus = " + nodBonus.OuterXml.ToString());
Log.Info("blnConcatSelectedValue = " + blnConcatSelectedValue.ToString());
Log.Info("intRating = " + intRating.ToString());
Log.Info("strFriendlyName = " + strFriendlyName);
Log.Info("intRating = " + intRating.ToString());
bool blnSuccess = true;
/*try
{*/
if (nodBonus == null)
{
_strForcedValue = "";
_strLimitSelection = "";
Log.Exit("CreateImprovements");
return true;
}
string strUnique = "";
if (nodBonus.Attributes["unique"] != null)
strUnique = nodBonus.Attributes["unique"].InnerText;
_strSelectedValue = "";
Log.Info(
"_strForcedValue = " + _strForcedValue);
Log.Info(
"_strLimitSelection = " + _strLimitSelection);
// If no friendly name was provided, use the one from SourceName.
if (strFriendlyName == "")
strFriendlyName = strSourceName;
if (nodBonus.HasChildNodes)
{
Log.Info("Has Child Nodes");
// Select Text (custom entry for things like Allergy).
if (NodeExists(nodBonus, "selecttext"))
{
Log.Info("selecttext");
if (_objCharacter != null)
{
if (_strForcedValue != "")
{
_strLimitSelection = _strForcedValue;
}
else if (_objCharacter.Pushtext.Count != 0)
{
_strLimitSelection = _objCharacter.Pushtext.Pop();
}
}
Log.Info("_strForcedValue = " + _strSelectedValue);
Log.Info("_strLimitSelection = " + _strLimitSelection);
// Display the Select Text window and record the value that was entered.
frmSelectText frmPickText = new frmSelectText();
frmPickText.Description = LanguageManager.Instance.GetString("String_Improvement_SelectText")
.Replace("{0}", strFriendlyName);
if (_strLimitSelection != "")
{
frmPickText.SelectedValue = _strLimitSelection;
frmPickText.Opacity = 0;
}
frmPickText.ShowDialog();
// Make sure the dialogue window was not canceled.
if (frmPickText.DialogResult == DialogResult.Cancel)
{
Rollback();
blnSuccess = false;
_strForcedValue = "";
_strLimitSelection = "";
Log.Exit("CreateImprovements");
return false;
}
_strSelectedValue = frmPickText.SelectedValue;
if (blnConcatSelectedValue)
//.........这里部分代码省略.........
开发者ID:Rockzo,项目名称:chummer5a,代码行数:101,代码来源:clsImprovement.cs
示例12: tsArmorName_Click
private void tsArmorName_Click(object sender, EventArgs e)
{
// Make sure a parent item is selected, then open the Select Accessory window.
try
{
if (treArmor.SelectedNode.Level == 0)
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_SelectArmorName"), LanguageManager.Instance.GetString("MessageTitle_SelectArmor"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
}
catch
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_SelectArmorName"), LanguageManager.Instance.GetString("MessageTitle_SelectArmor"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (treArmor.SelectedNode.Level > 1)
treArmor.SelectedNode = treArmor.SelectedNode.Parent;
// Get the information for the currently selected Armor.
Armor objArmor = (Armor)_objFunctions.FindEquipment(treArmor.SelectedNode.Tag.ToString(), _objCharacter.Armor, typeof(Armor));
frmSelectText frmPickText = new frmSelectText();
frmPickText.Description = LanguageManager.Instance.GetString("String_ArmorName");
frmPickText.ShowDialog(this);
if (frmPickText.DialogResult == DialogResult.Cancel)
return;
objArmor.GivenName = frmPickText.SelectedValue;
treArmor.SelectedNode.Text = objArmor.DisplayName;
}
开发者ID:janhelke,项目名称:chummer2,代码行数:33,代码来源:frmCreate.cs
示例13: cmdAddComplexForm_Click
private void cmdAddComplexForm_Click(object sender, EventArgs e)
{
// The number of Complex Forms cannot exceed the character's LOG.
if (_objCharacter.ComplexForms.Count >= ((_objCharacter.RES.Value * 2) + _objImprovementManager.ValueOf(Improvement.ImprovementType.ComplexFormLimit)))
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_ComplexFormLimitCareer"), LanguageManager.Instance.GetString("MessageTitle_ComplexFormLimit"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
// Let the user select a Program.
frmSelectProgram frmPickProgram = new frmSelectProgram(_objCharacter);
frmPickProgram.ShowDialog(this);
// Make sure the dialogue window was not canceled.
if (frmPickProgram.DialogResult == DialogResult.Cancel)
return;
int intKarmaCost = _objOptions.KarmaNewComplexForm;
XmlDocument objXmlDocument = XmlManager.Instance.Load("complexforms.xml");
XmlNode objXmlProgram = objXmlDocument.SelectSingleNode("/chummer/complexforms/complexform[name = \"" + frmPickProgram.SelectedProgram + "\"]");
// Check for SelectText.
string strExtra = "";
if (objXmlProgram["bonus"] != null)
{
if (objXmlProgram["bonus"]["selecttext"] != null)
{
frmSelectText frmPickText = new frmSelectText();
frmPickText.Description = LanguageManager.Instance.GetString("String_Improvement_SelectText").Replace("{0}", frmPickProgram.SelectedProgram);
frmPickText.ShowDialog(this);
strExtra = frmPickText.SelectedValue;
}
}
TreeNode objNode = new TreeNode();
ComplexForm objProgram = new ComplexForm(_objCharacter);
objProgram.Create(objXmlProgram, _objCharacter, objNode, strExtra);
if (objProgram.InternalId == Guid.Empty.ToString())
return;
_objCharacter.ComplexForms.Add(objProgram);
// If using the optional rule for costing the same as Spells, change the Karma cost.
if (_objOptions.AlternateComplexFormCost)
intKarmaCost = _objOptions.KarmaSpell;
// Make sure the character has enough Karma before letting them select a Complex Form.
if (_objCharacter.Karma < intKarmaCost)
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughKarma"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughKarma"), MessageBoxButtons.OK, MessageBoxIcon.Information);
// Remove the Improvements created by the Complex Form.
_objImprovementManager.RemoveImprovements(Improvement.ImprovementSource.ComplexForm, objProgram.InternalId);
return;
}
if (!ConfirmKarmaExpense(LanguageManager.Instance.GetString("Message_ConfirmKarmaExpenseSpend").Replace("{0}", objProgram.DisplayNameShort).Replace("{1}", intKarmaCost.ToString())))
{
// Remove the Improvements created by the Complex Form.
_objImprovementManager.RemoveImprovements(Improvement.ImprovementSource.ComplexForm, objProgram.InternalId);
return;
}
treComplexForms.Nodes[0].Nodes.Add(objNode);
treComplexForms.Nodes[0].Expand();
// Create the Expense Log Entry.
ExpenseLogEntry objExpense = new ExpenseLogEntry();
objExpense.Create(intKarmaCost * -1, LanguageManager.Instance.GetString("String_ExpenseLearnComplexForm") + " " + objProgram.DisplayNameShort, ExpenseType.Karma, DateTime.Now);
_objCharacter.ExpenseEntries.Add(objExpense);
_objCharacter.Karma -= intKarmaCost;
ExpenseUndo objUndo = new ExpenseUndo();
objUndo.CreateKarma(KarmaExpenseType.AddComplexForm, objProgram.InternalId);
objExpense.Undo = objUndo;
_objFunctions.SortTree(treComplexForms);
UpdateCharacterInfo();
_blnIsDirty = true;
UpdateWindowTitle();
if (frmPickProgram.AddAgain)
cmdAddComplexForm_Click(sender, e);
}
开发者ID:Althalusdlg,项目名称:chummer5a,代码行数:85,代码来源:frmCareer.cs
示例14: 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
示例15: tsWeaponName_Click
private void tsWeaponName_Click(object sender, EventArgs e)
{
// Make sure a parent item is selected, then open the Select Accessory window.
try
{
if (treWeapons.SelectedNode.Level == 0)
{
|
请发表评论