本文整理汇总了C#中Chummer.CommonFunctions类的典型用法代码示例。如果您正苦于以下问题:C# CommonFunctions类的具体用法?C# CommonFunctions怎么用?C# CommonFunctions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CommonFunctions类属于Chummer命名空间,在下文中一共展示了CommonFunctions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: frmCareer
public frmCareer(Character objCharacter)
{
_objCharacter = objCharacter;
_objOptions = _objCharacter.Options;
_objFunctions = new CommonFunctions(_objCharacter);
_objFunctions.ContextMenuArmor = cmsArmor;
_objFunctions.ContextMenuArmorMod = cmsArmorMod;
_objFunctions.ContextMenuCyberware = cmsCyberware;
_objFunctions.ContextMenuGear = cmsGear;
_objFunctions.ContextMenuVehicle = cmsVehicle;
_objFunctions.ContextMenuVehicleMod = cmsVehicle;
_objFunctions.ContextMenuWeapon = cmsWeapon;
_objFunctions.ContextMenuWeaponAccessory = cmsWeaponAccessoryGear;
_objFunctions.ContextMenuWeaponMod = cmsWeaponMod;
_objImprovementManager = new ImprovementManager(_objCharacter);
_objController = new MainController(_objCharacter);
InitializeComponent();
// Add EventHandlers for the MAG and RES enabled events and tab enabled events.
_objCharacter.MAGEnabledChanged += objCharacter_MAGEnabledChanged;
_objCharacter.RESEnabledChanged += objCharacter_RESEnabledChanged;
_objCharacter.AdeptTabEnabledChanged += objCharacter_AdeptTabEnabledChanged;
_objCharacter.MagicianTabEnabledChanged += objCharacter_MagicianTabEnabledChanged;
_objCharacter.TechnomancerTabEnabledChanged += objCharacter_TechnomancerTabEnabledChanged;
_objCharacter.CritterTabEnabledChanged += objCharacter_CritterTabEnabledChanged;
_objCharacter.BlackMarketEnabledChanged += objCharacter_BlackMarketChanged;
_objCharacter.SensitiveSystemChanged += objCharacter_SensitiveSystemChanged;
_objCharacter.UneducatedChanged += objCharacter_UneducatedChanged;
_objCharacter.UncouthChanged += objCharacter_UncouthChanged;
_objCharacter.InfirmChanged += objCharacter_InfirmChanged;
GlobalOptions.Instance.MRUChanged += PopulateMRU;
LanguageManager.Instance.Load(this);
// Update the text in the Menus so they can be merged with frmMain properly.
foreach (ToolStripMenuItem objItem in mnuCreateMenu.Items.OfType<ToolStripMenuItem>())
{
if (objItem.Tag != null)
{
objItem.Text = LanguageManager.Instance.GetString(objItem.Tag.ToString());
}
}
_lvwKarmaColumnSorter = new ListViewColumnSorter();
_lvwKarmaColumnSorter.SortColumn = 0;
_lvwKarmaColumnSorter.Order = SortOrder.Descending;
lstKarma.ListViewItemSorter = _lvwKarmaColumnSorter;
_lvwNuyenColumnSorter = new ListViewColumnSorter();
_lvwNuyenColumnSorter.SortColumn = 0;
_lvwNuyenColumnSorter.Order = SortOrder.Descending;
lstNuyen.ListViewItemSorter = _lvwNuyenColumnSorter;
SetTooltips();
MoveControls();
}
示例2: frmCreate
public frmCreate(Character objCharacter)
{
_objCharacter = objCharacter;
_objOptions = _objCharacter.Options;
_objFunctions = new CommonFunctions(_objCharacter);
_objImprovementManager = new ImprovementManager(_objCharacter);
_objController = new MainController(_objCharacter);
InitializeComponent();
// Add EventHandlers for the various events MAG, RES, Qualities, etc.
_objCharacter.MAGEnabledChanged += objCharacter_MAGEnabledChanged;
_objCharacter.RESEnabledChanged += objCharacter_RESEnabledChanged;
_objCharacter.AdeptTabEnabledChanged += objCharacter_AdeptTabEnabledChanged;
_objCharacter.MagicianTabEnabledChanged += objCharacter_MagicianTabEnabledChanged;
_objCharacter.TechnomancerTabEnabledChanged += objCharacter_TechnomancerTabEnabledChanged;
_objCharacter.InitiationTabEnabledChanged += objCharacter_InitiationTabEnabledChanged;
_objCharacter.CritterTabEnabledChanged += objCharacter_CritterTabEnabledChanged;
_objCharacter.BlackMarketEnabledChanged += objCharacter_BlackMarketDiscountChanged;
_objCharacter.SkillsSection.UneducatedChanged += objCharacter_UneducatedChanged;
_objCharacter.SkillsSection.UncouthChanged += objCharacter_UncouthChanged;
_objCharacter.FriendsInHighPlacesChanged += objCharacter_FriendsInHighPlacesChanged;
_objCharacter.SkillsSection.SchoolOfHardKnocksChanged += objCharacter_SchoolOfHardKnocksChanged;
_objCharacter.ExConChanged += objCharacter_ExConChanged;
_objCharacter.TrustFundChanged += objCharacter_TrustFundChanged;
_objCharacter.SkillsSection.TechSchoolChanged += objCharacter_TechSchoolChanged;
_objCharacter.RestrictedGearChanged += objCharacter_RestrictedGearChanged;
_objCharacter.OverclockerChanged += objCharacter_OverclockerChanged;
_objCharacter.MadeManChanged += objCharacter_MadeManChanged;
_objCharacter.SkillsSection.LinguistChanged += objCharacter_LinguistChanged;
_objCharacter.LightningReflexesChanged += objCharacter_LightningReflexesChanged;
_objCharacter.FameChanged += objCharacter_FameChanged;
_objCharacter.BornRichChanged += objCharacter_BornRichChanged;
_objCharacter.ErasedChanged += objCharacter_ErasedChanged;
tabSkillUc.ChildPropertyChanged += SkillPropertyChanged;
GlobalOptions.Instance.MRUChanged += PopulateMRU;
LanguageManager.Instance.Load(GlobalOptions.Instance.Language, this);
// Update the text in the Menus so they can be merged with frmMain properly.
foreach (ToolStripMenuItem objItem in mnuCreateMenu.Items.OfType<ToolStripMenuItem>())
{
if (objItem.Tag != null)
{
objItem.Text = LanguageManager.Instance.GetString(objItem.Tag.ToString());
}
}
SetTooltips();
MoveControls();
}
示例3: frmCareer
public frmCareer(Character objCharacter)
{
_objCharacter = objCharacter;
_objOptions = _objCharacter.Options;
_objFunctions = new CommonFunctions(_objCharacter);
_objImprovementManager = new ImprovementManager(_objCharacter);
_objController = new MainController(_objCharacter);
InitializeComponent();
// Add EventHandlers for the MAG and RES enabled events and tab enabled events.
_objCharacter.MAGEnabledChanged += objCharacter_MAGEnabledChanged;
_objCharacter.RESEnabledChanged += objCharacter_RESEnabledChanged;
_objCharacter.AdeptTabEnabledChanged += objCharacter_AdeptTabEnabledChanged;
_objCharacter.MagicianTabEnabledChanged += objCharacter_MagicianTabEnabledChanged;
_objCharacter.TechnomancerTabEnabledChanged += objCharacter_TechnomancerTabEnabledChanged;
_objCharacter.CritterTabEnabledChanged += objCharacter_CritterTabEnabledChanged;
_objCharacter.SkillsSection.UneducatedChanged += objCharacter_UneducatedChanged;
_objCharacter.SkillsSection.UncouthChanged += objCharacter_UncouthChanged;
_objCharacter.FameChanged += objCharacter_FameChanged;
tabSkillsUc.ChildPropertyChanged += SkillPropertyChanged;
GlobalOptions.Instance.MRUChanged += PopulateMRU;
LanguageManager.Instance.Load(GlobalOptions.Instance.Language, this);
// Update the text in the Menus so they can be merged with frmMain properly.
foreach (ToolStripMenuItem objItem in mnuCreateMenu.Items.OfType<ToolStripMenuItem>())
{
if (objItem.Tag != null)
{
objItem.Text = LanguageManager.Instance.GetString(objItem.Tag.ToString());
}
}
_lvwKarmaColumnSorter = new ListViewColumnSorter();
_lvwKarmaColumnSorter.SortColumn = 0;
_lvwKarmaColumnSorter.Order = SortOrder.Descending;
lstKarma.ListViewItemSorter = _lvwKarmaColumnSorter;
_lvwNuyenColumnSorter = new ListViewColumnSorter();
_lvwNuyenColumnSorter.SortColumn = 0;
_lvwNuyenColumnSorter.Order = SortOrder.Descending;
lstNuyen.ListViewItemSorter = _lvwNuyenColumnSorter;
SetTooltips();
MoveControls();
}
示例4: frmCreate
public frmCreate(Character objCharacter)
{
_objCharacter = objCharacter;
_objOptions = _objCharacter.Options;
_objFunctions = new CommonFunctions(_objCharacter);
_objImprovementManager = new ImprovementManager(_objCharacter);
_objController = new MainController(_objCharacter);
InitializeComponent();
// Add EventHandlers for the MAG and RES enabled events and tab enabled events.
_objCharacter.MAGEnabledChanged += objCharacter_MAGEnabledChanged;
_objCharacter.RESEnabledChanged += objCharacter_RESEnabledChanged;
_objCharacter.AdeptTabEnabledChanged += objCharacter_AdeptTabEnabledChanged;
_objCharacter.MagicianTabEnabledChanged += objCharacter_MagicianTabEnabledChanged;
_objCharacter.TechnomancerTabEnabledChanged += objCharacter_TechnomancerTabEnabledChanged;
_objCharacter.InitiationTabEnabledChanged += objCharacter_InitiationTabEnabledChanged;
_objCharacter.CritterTabEnabledChanged += objCharacter_CritterTabEnabledChanged;
_objCharacter.BlackMarketEnabledChanged += objCharacter_BlackMarketChanged;
_objCharacter.UneducatedChanged += objCharacter_UneducatedChanged;
_objCharacter.UncouthChanged += objCharacter_UncouthChanged;
_objCharacter.InfirmChanged += objCharacter_InfirmChanged;
GlobalOptions.Instance.MRUChanged += PopulateMRU;
LanguageManager.Instance.Load(GlobalOptions.Instance.Language, this);
// Update the text in the Menus so they can be merged with frmMain properly.
foreach (ToolStripMenuItem objItem in mnuCreateMenu.Items.OfType<ToolStripMenuItem>())
{
if (objItem.Tag != null)
{
objItem.Text = LanguageManager.Instance.GetString(objItem.Tag.ToString());
}
}
SetTooltips();
MoveControls();
}
示例5: lblVehicleSource_Click
private void lblVehicleSource_Click(object sender, EventArgs e)
{
CommonFunctions objCommon = new CommonFunctions(_objCharacter);
_objFunctions.OpenPDF(lblVehicleSource.Text);
}
示例6: frmMain_Load
private void frmMain_Load(object sender, EventArgs e)
{
if (GlobalOptions.Instance.StartupFullscreen)
this.WindowState = FormWindowState.Maximized;
if (GlobalOptions.Instance.UseLogging)
{
CommonFunctions objFunctions = new CommonFunctions();
}
}
示例7: ProcessBonus
//.........这里部分代码省略.........
CreateImprovement("", objImprovementSource, strSourceName, Improvement.ImprovementType.Initiation, "",
ValueToInt(bonusNode.InnerText, intRating));
_objCharacter.InitiateGrade += ValueToInt(bonusNode.InnerText, intRating);
}
// Check for Submersion.
if (bonusNode.LocalName == ("submersion"))
{
Log.Info("submersion");
Log.Info("submersion = " + bonusNode.OuterXml.ToString());
Log.Info("Calling CreateImprovement");
CreateImprovement("", objImprovementSource, strSourceName, Improvement.ImprovementType.Submersion, "",
ValueToInt(bonusNode.InnerText, intRating));
_objCharacter.SubmersionGrade += ValueToInt(bonusNode.InnerText, intRating);
}
// Check for Skillwires.
if (bonusNode.LocalName == ("skillwire"))
{
Log.Info("skillwire");
Log.Info("skillwire = " + bonusNode.OuterXml.ToString());
Log.Info("Calling CreateImprovement");
CreateImprovement("", objImprovementSource, strSourceName, Improvement.ImprovementType.Skillwire, "",
ValueToInt(bonusNode.InnerText, intRating));
}
// Check for Hardwires.
if (bonusNode.LocalName == ("hardwires"))
{
Log.Info("hardwire");
Log.Info("hardwire = " + bonusNode.OuterXml.ToString());
Log.Info("Calling CreateImprovement");
Cyberware objCyberware = new Cyberware(_objCharacter);
CommonFunctions _objFunctions = new CommonFunctions();
objCyberware = _objFunctions.FindCyberware(strSourceName, _objCharacter.Cyberware);
if (objCyberware == null)
{
Log.Info("_strSelectedValue = " + _strSelectedValue);
Log.Info("_strForcedValue = " + _strForcedValue);
// Display the Select Skill window and record which Skill was selected.
frmSelectSkill frmPickSkill = new frmSelectSkill(_objCharacter);
if (strFriendlyName != "")
frmPickSkill.Description = LanguageManager.Instance.GetString("String_Improvement_SelectSkillNamed")
.Replace("{0}", strFriendlyName);
else
frmPickSkill.Description = LanguageManager.Instance.GetString("String_Improvement_SelectSkill");
Log.Info("selectskill = " + bonusNode.OuterXml.ToString());
if (bonusNode.OuterXml.Contains("skillgroup"))
frmPickSkill.OnlySkillGroup = bonusNode.Attributes["skillgroup"].InnerText;
else if (bonusNode.OuterXml.Contains("skillcategory"))
frmPickSkill.OnlyCategory = bonusNode.Attributes["skillcategory"].InnerText;
else if (bonusNode.OuterXml.Contains("excludecategory"))
frmPickSkill.ExcludeCategory = bonusNode.Attributes["excludecategory"].InnerText;
else if (bonusNode.OuterXml.Contains("limittoskill"))
frmPickSkill.LimitToSkill = bonusNode.Attributes["limittoskill"].InnerText;
else if (bonusNode.OuterXml.Contains("limittoattribute"))
frmPickSkill.LinkedAttribute = bonusNode.Attributes["limittoattribute"].InnerText;
if (_strForcedValue != "")
{
frmPickSkill.OnlySkill = _strForcedValue;
frmPickSkill.Opacity = 0;
}
frmPickSkill.ShowDialog();
示例8: lblSkillName_Click
private void lblSkillName_Click(object sender, EventArgs e)
{
string strBook = _objSkill.Source + " " + _objSkill.Page;
CommonFunctions objCommon = new CommonFunctions();
objCommon.OpenPDF(strBook);
nudSkill.Focus();
}
示例9: lblCritterPowerSource_Click
private void lblCritterPowerSource_Click(object sender, EventArgs e)
{
CommonFunctions objCommon = new CommonFunctions(_objCharacter);
objCommon.OpenPDF(lblCritterPowerSource.Text);
}
示例10: tsUndoNuyenExpense_Click
private void tsUndoNuyenExpense_Click(object sender, EventArgs e)
{
ListViewItem objItem = new ListViewItem();
try
{
objItem = lstNuyen.SelectedItems[0];
}
catch
{
return;
}
CommonFunctions objCommon = new CommonFunctions(_objCharacter);
ExpenseLogEntry objEntry = new ExpenseLogEntry();
objItem = lstNuyen.SelectedItems[0];
// Find the selected Nuyen Expense.
foreach (ExpenseLogEntry objCharacterEntry in _objCharacter.ExpenseEntries)
{
if (objCharacterEntry.InternalId == objItem.SubItems[3].Text)
{
objEntry = objCharacterEntry;
break;
}
}
if (objEntry.Undo == null)
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_UndoNoHistory"), LanguageManager.Instance.GetString("MessageTitle_NoUndoHistory"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
else if (objEntry.Undo.KarmaType == KarmaExpenseType.ImproveInitiateGrade)
{
// Get the grade of the item we're undoing and make sure it's the highest grade
int intMaxGrade = 0;
foreach (InitiationGrade objGrade in _objCharacter.InitiationGrades)
{
intMaxGrade = Math.Max(intMaxGrade, objGrade.Grade);
}
foreach (InitiationGrade objGrade in _objCharacter.InitiationGrades)
{
if (objGrade.InternalId == objEntry.Undo.ObjectId)
{
if (objGrade.Grade < intMaxGrade)
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_UndoNotHighestGrade"), LanguageManager.Instance.GetString("MessageTitle_NotHighestGrade"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
break;
}
}
if (MessageBox.Show(LanguageManager.Instance.GetString("Message_UndoExpense"), LanguageManager.Instance.GetString("MessageTitle_UndoExpense"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
return;
}
else
{
if (MessageBox.Show(LanguageManager.Instance.GetString("Message_UndoExpense"), LanguageManager.Instance.GetString("MessageTitle_UndoExpense"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
return;
}
switch (objEntry.Undo.NuyenType)
{
case NuyenExpenseType.AddCyberware:
// Locate the Cyberware that was added.
int intOldPenalty = 0;
int intNewPenalty = 0;
foreach (Cyberware objCyberware in _objCharacter.Cyberware)
{
if (objCyberware.InternalId == objEntry.Undo.ObjectId)
{
foreach (Cyberware objChild in objCyberware.Children)
{
// Remove the Improvements created by child items.
_objImprovementManager.RemoveImprovements(Improvement.ImprovementSource.Cyberware, objChild.InternalId);
_objImprovementManager.RemoveImprovements(Improvement.ImprovementSource.Bioware, objChild.InternalId);
}
// Remove the Improvements created by the item.
_objImprovementManager.RemoveImprovements(Improvement.ImprovementSource.Cyberware, objCyberware.InternalId);
_objImprovementManager.RemoveImprovements(Improvement.ImprovementSource.Bioware, objCyberware.InternalId);
// Determine the character's Essence penalty before removing the Cyberware.
intOldPenalty = _objCharacter.EssencePenalty;
// Remove the Cyberware.
_objCharacter.Cyberware.Remove(objCyberware);
// Determine the character's Essence penalty after removing the Cyberware.
intNewPenalty = _objCharacter.EssencePenalty;
// Restore the character's MAG/RES if they have it.
//if (!_objCharacter.OverrideSpecialAttributeEssenceLoss && !_objCharacter.OverrideSpecialAttributeEssenceLoss)
//{
// if (intOldPenalty != intNewPenalty)
// {
// if (_objCharacter.MAGEnabled)
// _objCharacter.MAG.Value += (intOldPenalty - intNewPenalty);
// if (_objCharacter.RESEnabled)
// _objCharacter.RES.Value += (intOldPenalty - intNewPenalty);
// }
//}
//.........这里部分代码省略.........
示例11: lblPowerName_Click
private void lblPowerName_Click(object sender, EventArgs e)
{
string strBook = _objPower.Source + " " + _objPower.Page;
CommonFunctions objCommon = new CommonFunctions();
objCommon.OpenPDF(strBook);
}
示例12: SetToolTips
private void SetToolTips()
{
const int width = 50;
var functions = new CommonFunctions();
tipTooltip.SetToolTip(chkKnucks, functions.WordWrap(LanguageManager.Instance.GetString("Tip_OptionsKnucks"), width));
tipTooltip.SetToolTip(chkIgnoreArt, functions.WordWrap(LanguageManager.Instance.GetString("Tip_OptionsIgnoreArt"), width));
tipTooltip.SetToolTip(chkCyberlegMovement, functions.WordWrap(LanguageManager.Instance.GetString("Tip_OptionsCyberlegMovement"), width));
tipTooltip.SetToolTip(chkDontDoubleQualities, functions.WordWrap(LanguageManager.Instance.GetString("Tip_OptionsDontDoubleQualities"), width));
tipTooltip.SetToolTip(chkUsePointsOnBrokenGroups, functions.WordWrap(LanguageManager.Instance.GetString("Tip_OptionsUsePointsOnBrokenGroups"), width));
tipTooltip.SetToolTip(chkAllowInitiation, functions.WordWrap(LanguageManager.Instance.GetString("Tip_OptionsAllowInitiation"), width));
}
示例13: cmdPDFTest_Click
private void cmdPDFTest_Click(object sender, EventArgs e)
{
if (txtPDFLocation.Text == string.Empty)
return;
SaveRegistrySettings();
CommonFunctions objCommon = new CommonFunctions(null);
objCommon.OpenPDF(treSourcebook.SelectedNode.Tag + " 5");
}
示例14: MainController
public MainController(Character objCharacter)
{
_objCharacter = objCharacter;
_objImprovementManager = new ImprovementManager(_objCharacter);
_objFunctions = new CommonFunctions(_objCharacter);
}
示例15: SaveRegistrySettings
/// <summary>
/// Save the global settings to the registry.
/// </summary>
private void SaveRegistrySettings()
{
// If we're just now enabling logging, flush the log
if (!GlobalOptions.Instance.UseLogging && chkUseLogging.Checked)
{
CommonFunctions objFunctions = new CommonFunctions();
objFunctions.LogFlush();
}
// Set Registry values.
GlobalOptions.Instance.AutomaticUpdate = chkAutomaticUpdate.Checked;
GlobalOptions.Instance.LocalisedUpdatesOnly = chkLocalisedUpdatesOnly.Checked;
GlobalOptions.Instance.UseLogging = chkUseLogging.Checked;
GlobalOptions.Instance.Language = cboLanguage.SelectedValue.ToString();
GlobalOptions.Instance.StartupFullscreen = chkStartupFullscreen.Checked;
GlobalOptions.Instance.SingleDiceRoller = chkSingleDiceRoller.Checked;
GlobalOptions.Instance.DefaultCharacterSheet = cboXSLT.SelectedValue.ToString();
GlobalOptions.Instance.DatesIncludeTime = chkDatesIncludeTime.Checked;
GlobalOptions.Instance.PrintToFileFirst = chkPrintToFileFirst.Checked;
GlobalOptions.Instance.PDFAppPath = txtPDFAppPath.Text;
Microsoft.Win32.RegistryKey objRegistry = Microsoft.Win32.Registry.CurrentUser.CreateSubKey("Software\\Chummer5");
objRegistry.SetValue("autoupdate", chkAutomaticUpdate.Checked.ToString());
objRegistry.SetValue("localisedupdatesonly", chkLocalisedUpdatesOnly.Checked.ToString());
objRegistry.SetValue("uselogging", chkUseLogging.Checked.ToString());
objRegistry.SetValue("language", cboLanguage.SelectedValue.ToString());
objRegistry.SetValue("startupfullscreen", chkStartupFullscreen.Checked.ToString());
objRegistry.SetValue("singlediceroller", chkSingleDiceRoller.Checked.ToString());
objRegistry.SetValue("defaultsheet", cboXSLT.SelectedValue.ToString());
objRegistry.SetValue("datesincludetime", chkDatesIncludeTime.Checked.ToString());
objRegistry.SetValue("printtofilefirst", chkPrintToFileFirst.Checked.ToString());
objRegistry.SetValue("pdfapppath", txtPDFAppPath.Text);
// Save the SourcebookInfo.
Microsoft.Win32.RegistryKey objSourceRegistry = Microsoft.Win32.Registry.CurrentUser.CreateSubKey("Software\\Chummer5\\Sourcebook");
foreach (SourcebookInfo objSource in GlobalOptions.Instance.SourcebookInfo)
objSourceRegistry.SetValue(objSource.Code, objSource.Path + "|" + objSource.Offset.ToString());
}