示例#1
0
        /// <summary>
        /// Create a new character and show the Create Form.
        /// </summary>
        private void ShowNewForm(object sender, EventArgs e)
		{
			string strFilePath = Path.Combine(Environment.CurrentDirectory, "settings", "default.xml");
			if (!File.Exists(strFilePath))
			{
				if (MessageBox.Show(LanguageManager.Instance.GetString("Message_CharacterOptions_OpenOptions"), LanguageManager.Instance.GetString("MessageTitle_CharacterOptions_OpenOptions"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
				{
					frmOptions frmOptions = new frmOptions();
					frmOptions.ShowDialog();
				}
			}
			Character objCharacter = new Character();
			string settingsPath = Path.Combine(Environment.CurrentDirectory, "settings");
			string[] settingsFiles = Directory.GetFiles(settingsPath, "*.xml");

			if (settingsFiles.Length > 1)
			{
				frmSelectSetting frmPickSetting = new frmSelectSetting();
				frmPickSetting.ShowDialog(this);

				if (frmPickSetting.DialogResult == DialogResult.Cancel)
					return;

				objCharacter.SettingsFile = frmPickSetting.SettingsFile;
			}
			else
			{
				string strSettingsFile = settingsFiles[0];
				objCharacter.SettingsFile = Path.GetFileName(strSettingsFile);
			}

			// Show the BP selection window.
			frmSelectBuildMethod frmBP = new frmSelectBuildMethod(objCharacter);
			frmBP.ShowDialog();

			if (frmBP.DialogResult == DialogResult.Cancel)
				return;
            if (objCharacter.BuildMethod == CharacterBuildMethod.Karma || objCharacter.BuildMethod == CharacterBuildMethod.LifeModule)
            {
                frmKarmaMetatype frmSelectMetatype = new frmKarmaMetatype(objCharacter);
                frmSelectMetatype.ShowDialog();

                if (frmSelectMetatype.DialogResult == DialogResult.Cancel)
                { return; }
            }
            // Show the Metatype selection window.
            else if (objCharacter.BuildMethod == CharacterBuildMethod.Priority || objCharacter.BuildMethod == CharacterBuildMethod.SumtoTen)
            {
                frmPriorityMetatype frmSelectMetatype = new frmPriorityMetatype(objCharacter);
                frmSelectMetatype.ShowDialog();

                if (frmSelectMetatype.DialogResult == DialogResult.Cancel)
                { return; }
            }

			// Add the Unarmed Attack Weapon to the character.
			try
			{
				XmlDocument objXmlDocument = XmlManager.Instance.Load("weapons.xml");
				XmlNode objXmlWeapon = objXmlDocument.SelectSingleNode("/chummer/weapons/weapon[name = \"Unarmed Attack\"]");
				TreeNode objDummy = new TreeNode();
				Weapon objWeapon = new Weapon(objCharacter);
				objWeapon.Create(objXmlWeapon, objCharacter, objDummy, null, null, null);
				objCharacter.Weapons.Add(objWeapon);
			}
			catch
			{
			}

			frmCreate frmNewCharacter = new frmCreate(objCharacter);
			frmNewCharacter.MdiParent = this;
			frmNewCharacter.WindowState = FormWindowState.Maximized;
			frmNewCharacter.Show();

			objCharacter.CharacterNameChanged += objCharacter_CharacterNameChanged;
		}
示例#2
0
		private void optionsToolStripMenuItem_Click(object sender, EventArgs e)
		{
			frmOptions frmOptions = new frmOptions();
			frmOptions.ShowDialog(this);
		}