private void buttonPreviousStep_Click(object sender, EventArgs e)
        {
            NewCountryCultrues ncc = new NewCountryCultrues(countryTagName, countryName, mf);

            foreach (XmlNode node in countryHistory.ChildNodes[1])
            {
                foreach (var reforms in listBoxSocialReforms.Items)
                {
                    if (node.Name == reforms.ToString())
                    {
                        countryHistory.ChildNodes[1].RemoveChild(node);
                    }
                }
            }
            countryHistory.Save(".\\xml\\history\\countries\\" + countryTagName + " - " + countryName + ".txt.xml");
            ncc.Show();
            this.Close();
        }
Пример #2
0
        private void buttonNextStep_Click(object sender, EventArgs e)
        {
            if (!isColor(int.Parse(textBoxRed.Text)) && isColor(int.Parse(textBoxGreen.Text)) && isColor(int.Parse(textBoxBlue.Text)))
            {
                MessageBox.Show("颜色格式错误!");
                return;
            }
            //14/16
            if (comboBoxGraphics.SelectedIndex == -1 || comboBoxCaptial.SelectedIndex == -1 ||
                comboBoxPrimaryCulture.SelectedIndex == -1 || comboBoxReligion.SelectedIndex == -1 || comboBoxGovernment.SelectedIndex == -1 ||
                comboBoxNationalValue.SelectedIndex == -1 || string.IsNullOrEmpty(textBoxPlurality.Text) || string.IsNullOrEmpty(textBoxLiteracy.Text))
            {
                MessageBox.Show("不能留空!");
                return;
            }
            countries.ChildNodes [1].SelectSingleNode("color").InnerText             = Victoria2.Domain.Comm.FileHelper.Escape("{ " + textBoxRed.Text + " " + textBoxGreen.Text + " " + textBoxBlue.Text + " }");
            countries.ChildNodes [1].SelectSingleNode("graphical_culture").InnerText = Victoria2.Domain.Comm.FileHelper.Escape(comboBoxGraphics.Text);
            countries.Save(".\\xml\\common\\countries\\" + CountryName + ".txt.xml");

            XmlElement capital = countryHistory.CreateElement("capital");

            capital.InnerText = Victoria2.Domain.Comm.FileHelper.Escape(comboIndexDic [comboBoxCaptial.SelectedIndex]);
            countryHistory.ChildNodes [1].AppendChild(capital);

            XmlElement primary_culture = countryHistory.CreateElement("primary_culture");

            primary_culture.InnerText = Victoria2.Domain.Comm.FileHelper.Escape(comboBoxPrimaryCulture.SelectedItem.ToString( ));
            countryHistory.ChildNodes [1].AppendChild(primary_culture);

            XmlElement religion = countryHistory.CreateElement("religion");

            religion.InnerText = Victoria2.Domain.Comm.FileHelper.Escape(comboBoxReligion.SelectedItem.ToString( ));
            countryHistory.ChildNodes [1].AppendChild(religion);

            XmlElement government = countryHistory.CreateElement("government");

            government.InnerText = Victoria2.Domain.Comm.FileHelper.Escape(comboBoxGovernment.SelectedItem.ToString( ));
            countryHistory.ChildNodes [1].AppendChild(government);

            XmlElement plurality = countryHistory.CreateElement("plurality");

            plurality.InnerText = Victoria2.Domain.Comm.FileHelper.Escape(textBoxPlurality.Text);
            countryHistory.ChildNodes [1].AppendChild(plurality);

            XmlElement nationalvalue = countryHistory.CreateElement("nationalvalue");

            nationalvalue.InnerText = Victoria2.Domain.Comm.FileHelper.Escape(comboBoxNationalValue.SelectedItem.ToString( ));
            countryHistory.ChildNodes [1].AppendChild(nationalvalue);

            XmlElement literacy = countryHistory.CreateElement("literacy");

            literacy.InnerText = Victoria2.Domain.Comm.FileHelper.Escape(textBoxLiteracy.Text);
            countryHistory.ChildNodes [1].AppendChild(literacy);

            if (checkBoxCivilized.Checked)
            {
                XmlElement civilized = countryHistory.CreateElement("civilized");
                civilized.InnerText = "yes";
                countryHistory.ChildNodes [1].AppendChild(civilized);
            }//is_releasable_vassal

            XmlElement is_releasable_vassal = countryHistory.CreateElement("is_releasable_vassal");

            is_releasable_vassal.InnerText = checkBoxIsReleasableVassal.Checked ? "yes" : "no";
            countryHistory.ChildNodes [1].AppendChild(is_releasable_vassal);

            if (!string.IsNullOrEmpty(textBoxNonStateCultureLiteracy.Text))
            {
                XmlElement non_state_culture_literacy = countryHistory.CreateElement("non_state_culture_literacy");
                non_state_culture_literacy.InnerText = Victoria2.Domain.Comm.FileHelper.Escape(textBoxNonStateCultureLiteracy.Text);
                countryHistory.ChildNodes [1].AppendChild(non_state_culture_literacy);
            }
            //non_state_culture_literacy
            //textBoxPrestige

            if (!string.IsNullOrEmpty(textBoxPrestige.Text))
            {
                XmlElement prestige = countryHistory.CreateElement("prestige");
                prestige.InnerText = Victoria2.Domain.Comm.FileHelper.Escape(textBoxPrestige.Text);
                countryHistory.ChildNodes [1].AppendChild(prestige);
            }
            //school
            if (comboBoxSchool.SelectedIndex != -1)
            {
                XmlElement schools = countryHistory.CreateElement("schools");
                schools.InnerText = Victoria2.Domain.Comm.FileHelper.Escape(comboBoxSchool.SelectedItem.ToString( ));
                countryHistory.ChildNodes [1].AppendChild(schools);
            }
            //textBoxConsciousness
            if (!string.IsNullOrEmpty(textBoxConsciousness.Text))
            {
                XmlElement consciousness = countryHistory.CreateElement("consciousness");
                consciousness.InnerText = Victoria2.Domain.Comm.FileHelper.Escape(textBoxConsciousness.Text);
                countryHistory.ChildNodes [1].AppendChild(consciousness);
            }
            //textBoxNonstateConsciousness
            if (!string.IsNullOrEmpty(textBoxNonstateConsciousness.Text))
            {
                XmlElement nonstate_consciousness = countryHistory.CreateElement("nonstate_consciousness");
                nonstate_consciousness.InnerText = Victoria2.Domain.Comm.FileHelper.Escape(textBoxNonstateConsciousness.Text);
                countryHistory.ChildNodes [1].AppendChild(nonstate_consciousness);
            }//ruling_party

            XmlElement ruling_party = countryHistory.CreateElement("ruling_party");

            ruling_party.InnerText = "";
            countryHistory.ChildNodes [1].AppendChild(ruling_party);

            countryHistory.Save(".\\xml\\history\\countries\\" + CountryTagName + " - " + CountryName + ".txt.xml");
            NewCountryCultrues ncc = new NewCountryCultrues(CountryTagName, CountryName, mf);

            ncc.Show( );
            //ncc.MdiParent = this.MdiParent;
            this.Close( );
        }