Ejemplo n.º 1
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (build == null)
                return;

            if (MessageBox.Show("This will generate builds", "Continue?", MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.OK)
            {
                // make a new form that generates builds into it
                // have a weight panel near the stats
                // sort live on change
                // copy weights back to here

                var ff = new Generate(build);
                var res = ff.ShowDialog();
                if (res == System.Windows.Forms.DialogResult.OK)
                {
                    loading = true;
                    foreach (var stat in statNames)
                    {
                        var ctrlWorth = groupBox1.Controls.Find(stat + "Worth", true).FirstOrDefault();

                        if (build.Sort[stat] > 0)
                            ctrlWorth.Text = build.Sort[stat].ToString();
                        else
                            ctrlWorth.Text = "";
                    }
                    foreach (var extra in extraNames)
                    {
                        var ctrlWorth = groupBox1.Controls.Find(extra + "Worth", true).FirstOrDefault();

                        if (build.Sort.ExtraGet(extra) > 0)
                            ctrlWorth.Text = build.Sort.ExtraGet(extra).ToString();
                        else
                            ctrlWorth.Text = "";
                    }
                    loading = false;
                }
                else
                {
                    foreach (var stat in statNames)
                    {
                        var ctrlWorth = groupBox1.Controls.Find(stat + "Worth", true).FirstOrDefault();
                        int val = 0;
                        int.TryParse(ctrlWorth.Text, out val);
                        build.Sort[stat] = val;
                    }
                    foreach (var extra in extraNames)
                    {
                        var ctrlWorth = groupBox1.Controls.Find(extra + "Worth", true).FirstOrDefault();
                        int val = 0;
                        int.TryParse(ctrlWorth.Text, out val);
                        build.Sort.ExtraSet(extra, val);
                    }

                }
                UpdateGlobal();
            }
        }
Ejemplo n.º 2
0
        void testBuildClick(object sender, EventArgs e)
        {
            if (build == null)
            {
                return;
            }

            if (AnnoyUser())
            {
                return;
            }

            // make a new form that generates builds into it
            // have a weight panel near the stats
            // sort live on change
            // copy weights back to here

            if (!Program.config.AppSettings.Settings.AllKeys.Contains("generateLive"))
            {
                var ff         = new Generate(build);
                var backupSort = new Stats(build.Sort);
                var res        = ff.ShowDialog();
                if (res == DialogResult.OK)
                {
                    loading = true;
                    foreach (var stat in Build.StatNames)
                    {
                        var ctrlWorth = groupBox1.Controls.Find(stat + "Worth", true).FirstOrDefault();
                        if (ctrlWorth == null)
                        {
                            continue;
                        }

                        ctrlWorth.Text = build.Sort[stat] != 0 ? build.Sort[stat].ToString() : "";
                    }
                    foreach (var extra in Build.ExtraNames)
                    {
                        var ctrlWorth = groupBox1.Controls.Find(extra + "Worth", true).FirstOrDefault();
                        if (ctrlWorth == null)
                        {
                            continue;
                        }

                        ctrlWorth.Text = build.Sort.ExtraGet(extra) != 0 ? build.Sort.ExtraGet(extra).ToString() : "";
                    }
                    for (int i = 0; i < 4; i++)
                    {
                        var ctrlWorth = groupBox1.Controls.Find("Skill" + i + "Worth", true).FirstOrDefault();
                        if (ctrlWorth == null)
                        {
                            continue;
                        }

                        ctrlWorth.Text = build.Sort.DamageSkillups[i] != 0 ? build.Sort.DamageSkillups[i].ToString() : "";
                    }
                    loading = false;
                }
                else
                {
                    foreach (var stat in Build.StatNames)
                    {
                        var ctrlWorth = groupBox1.Controls.Find(stat + "Worth", true).FirstOrDefault();
                        if (ctrlWorth == null)
                        {
                            continue;
                        }

                        double val;
                        double.TryParse(ctrlWorth.Text, out val);
                        build.Sort[stat] = val;
                    }

                    foreach (var extra in Build.ExtraNames)
                    {
                        var ctrlWorth = groupBox1.Controls.Find(extra + "Worth", true).FirstOrDefault();
                        if (ctrlWorth == null)
                        {
                            continue;
                        }

                        double val;
                        double.TryParse(ctrlWorth.Text, out val);
                        build.Sort.ExtraSet(extra, val);
                    }

                    for (int i = 0; i < 4; i++)
                    {
                        var ctrlWorth = groupBox1.Controls.Find("Skill" + i + "Worth", true).FirstOrDefault();
                        if (ctrlWorth == null)
                        {
                            continue;
                        }

                        double val;
                        double.TryParse(ctrlWorth.Text, out val);
                        build.Sort.DamageSkillupsSet(i, val);
                    }
                }
                UpdateGlobal();
            }
            else
            {
                if (testWindow == null || testWindow.IsDisposed)
                {
                    testWindow       = new GenerateLive(build);
                    testWindow.Owner = this;
                }
                if (!testWindow.Visible)
                {
                    testWindow.Show();
                }
                testWindow.Location = new Point(Location.X + Width, Location.Y);
            }
        }