コード例 #1
0
        private void construct_Click(object sender, EventArgs e)
        {
            Character C1 = new Character();

            Details.CharacterList.Add(C1);
            Details.CharacterList[0].Race = "Construct";
            C1.characterPanel(CharacterPanel);
            Details.characterPanel = CharacterPanel;
            var a = new Attributes();

            a.main();
            var f = new Flaws();

            f.main();

            int x = 0;
            var p = new BackgroundPanels();

            Details.panel = HumanPanel;
            this.Controls.Add(CharacterPanel);
            Continue.Visible  = true;
            Continue.Location = new System.Drawing.Point(Continue.Parent.Width / 2, Continue.Parent.Height - 40);

            panel1.Visible              = false;
            HumanPanel.Visible          = false;
            ConstructPanel.Visible      = true;
            ConstructPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink;
            CharacterPanel.Visible      = true;
            CharacterPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink;
            var construct = new Construct();

            construct.main();

            foreach (Control ctl in CharacterPanel.Controls)
            {
                if (ctl.Name == "race")
                {
                    ctl.Text = "Race: " + Details.CharacterList[0].Race;
                }
                if (ctl.Name == "nation")
                {
                    ctl.Text = "Nationality: " + Details.CharacterList[0].Nationality;
                }
            }

            ConstructPanel.Controls.Add(this.textBox1);
            ConstructPanel.Controls.Add(this.label1);
            label1.Text = "Constuct";

            ButtonGroup Nation = new ButtonGroup();

            Nation.Text     = "Nation";
            Nation.Location = new System.Drawing.Point(22, 60);


            foreach (string s in Construct.Nationality)
            {
                var         text      = s;
                RadioButton newButton = new RadioButton();

                if (x == 0)
                {
                    newButton.Checked = true;
                }

                newButton.Text  = text;
                newButton.Width = 250;
                Nation.Controls.Add(newButton);
                newButton.Location = new Point(1, 15 + (20 * x));
                x++;
            }
            Nation.AutoSize     = true;
            Nation.MinimumSize  = new System.Drawing.Size(50, 20);
            Nation.AutoSizeMode = AutoSizeMode.GrowAndShrink;
            x = 0;
            ConstructPanel.Controls.Add(Nation);
            Nation.Visible = false;
            Nation.Visible = true;
            Details.planet = Construct.Collectives;
            p.planetsPanel(ConstructPanel);
            p.LifePanel(ConstructPanel);
            CharacterPanel.Location = new System.Drawing.Point(HumanPanel.Width + 10, 13);
            Continue.Location       = new System.Drawing.Point(Continue.Parent.Width / 2, Continue.Parent.Height - 40);
        }
コード例 #2
0
        private void radioButtons_CheckedChanged(object sender, EventArgs e)
        {
            var         human       = new Human();
            var         construct   = new Construct();
            var         p           = new BackgroundPanels();
            RadioButton radioButton = sender as RadioButton;

            if (Details.buttonGroups.Count != 0 && radioButton.Checked == true)
            {
                var C1 = Details.CharacterList[0];
                C1.STR  = 1;
                C1.DEX  = 1;
                C1.WILL = 1;
                C1.RES  = 1;
                C1.INT  = 1;
                C1.PER  = 1;
                C1.Skills.Clear();

                if (radioButton.Parent.Text.ToString() == "Nation")
                {
                    GroupBox rb = Details.buttonGroups[0];
                    rb.Dispose();
                    Details.buttonGroups[0] = null;
                }
                else if (radioButton.Parent.Text.ToString() == "Planet")
                {
                    GroupBox rb1 = Details.buttonGroups[1];
                    rb1.Dispose();
                    Details.buttonGroups[1] = null;
                }
            }

            if (radioButton.Parent.Text.ToString() == "Nation" && radioButton.Checked == true)
            {
                if (radioButton.TabIndex == 0)
                {
                    p.planetsPanel(Details.panel);
                    foreach (Control ctl in Details.characterPanel.Controls)
                    {
                        if (ctl.Name == "nation")
                        {
                            Details.planet = Human.freeColonies;
                            Details.CharacterList[0].Nationality = radioButton.Text;
                            ctl.Text = "Nationality: " + Details.CharacterList[0].Nationality;
                        }
                    }
                }
                if (radioButton.TabIndex == 1)
                {
                    p.planetsPanel(Details.panel);
                    foreach (Control ctl in Details.characterPanel.Controls)
                    {
                        if (ctl.Name == "nation")
                        {
                            Details.planet = Human.secondColonies;
                            Details.CharacterList[0].Nationality = radioButton.Text;
                            ctl.Text = "Nationality: " + Details.CharacterList[0].Nationality;
                        }
                    }
                }
            }

            else if (radioButton.Parent.Text.ToString() == "Planet" && radioButton.Checked == true)
            {
                Details.CharacterList[0].Planet = radioButton.Text;

                if (Details.CharacterList[0].Nationality == "Democratic Alliance of  Free Colonies")
                {
                    switch (radioButton.TabIndex)
                    {
                    case 0:
                        Details.life = Human.Earthborn;
                        break;

                    case 1:
                        Details.life = Human.FirstExpansion;
                        break;

                    case 2:
                        Details.life = Human.FrontierWorld;
                        break;

                    case 3:
                        Details.life = Human.OrbitalString;
                        break;
                    }
                }
                if (Details.CharacterList[0].Nationality == "Second Wave Colonies")
                {
                    switch (radioButton.TabIndex)
                    {
                    case 0:
                        Details.life = Human.JungleWorld;
                        break;

                    case 1:
                        Details.life = Human.IceWorld;
                        break;

                    case 2:
                        Details.life = Human.DesertWorld;
                        break;

                    case 3:
                        Details.life = Human.MegaCity;
                        break;
                    }
                }
                p.LifePanel(Details.panel);
            }
            else if (radioButton.Parent.Name.ToString() == "Life" && radioButton.Checked == true)
            {
                Details.CharacterList[0].Life = radioButton.Text;
            }

            if (Details.CharacterList[0].Race == "Human")
            {
                human.Update("update", Details.panel);
            }
            else if (Details.CharacterList[0].Race == "Construct")
            {
                construct.Update("update", Details.panel);
            }

            foreach (Control ctl in Details.characterPanel.Controls)
            {
                switch (ctl.Name)
                {
                case "Planet":
                    ctl.Text = "Planet: " + Details.CharacterList[0].Planet;
                    break;

                case "Willpower":
                    ctl.Text = "Willpower: " + Details.CharacterList[0].WILL;
                    break;

                case "Strength":
                    ctl.Text = "Strength: " + Details.CharacterList[0].STR;
                    break;

                case "Resiliance":
                    ctl.Text = "Resiliance: " + Details.CharacterList[0].RES;
                    break;

                case "Dexterity":
                    ctl.Text = "Dexterity: " + Details.CharacterList[0].DEX;
                    break;

                case "Intelligence":
                    ctl.Text = "Intelligence: " + Details.CharacterList[0].INT;
                    break;

                case "Perception":
                    ctl.Text = "Perception: " + Details.CharacterList[0].PER;
                    break;

                case "Abilities":
                    ctl.Text = "Abilities: ";
                    foreach (string x in Details.CharacterList[0].Skills)
                    {
                        ctl.Text += x + "\n";
                    }
                    break;
                }
            }
        }