Esempio n. 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == string.Empty)
            {
                return;
            }

            try
            {
                var wdt = new WDT("World\\maps\\" + textBox1.Text + "\\" + textBox1.Text + ".wdt");
                if (!wdt.IsValid)
                {
                    return;
                }

                if (wdt.IsGlobalModel)
                {
                    _dungeonBuilder             = new DungeonBuilder(textBox1.Text);
                    _dungeonBuilder.OnProgress += OnProgress;
                    _builder       = null;
                    _lastProgressX = 0;
                }
                else
                {
                    int startX = startXBox.Text.Length > 0 ? int.Parse(startXBox.Text) : 0;
                    int startY = startYBox.Text.Length > 0 ? int.Parse(startYBox.Text) : 0;
                    int countX = countXBox.Text.Length > 0 ? int.Parse(countXBox.Text) : (64 - startX);
                    int countY = countYBox.Text.Length > 0 ? int.Parse(countYBox.Text) : (64 - startY);

                    startXBox.Text     = startX.ToString();
                    startXBox.ReadOnly = true;
                    startYBox.Text     = startY.ToString();
                    startYBox.ReadOnly = true;
                    countXBox.Text     = countX.ToString();
                    countXBox.ReadOnly = true;
                    countYBox.Text     = countY.ToString();
                    countYBox.ReadOnly = true;

                    _builder              = new ContinentBuilder(textBox1.Text, startX, startY, countX, countY);
                    _builder.OnTileEvent += OnTileEvent;
                    _dungeonBuilder       = null;
                }
            }
            catch (Exception)
            {
                return;
            }

            textBox1.ReadOnly = true;
            button1.Enabled   = false;
            button1.Text      = "Building...";
            _buildThread      = new Thread(RunBuild)
            {
                IsBackground = true
            };
            _buildThread.Start();
        }
        public void FlatBuild_DoesNotBuildContinents()
        {
            var continent = new ContinentBuilder()
                .Flat()
                .Build();

            Assert.IsNotNull(continent);
            Assert.IsNotNull(continent.Regions);
            Assert.IsTrue(continent.Regions.Count == 0);
        }
Esempio n. 3
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     if (_buildStarted)
     {
         button1.Text   = ContinentBuilder.PercentProgression() + " %";
         statL.Text     = ContinentBuilder.CurrentTile();
         timeLeftL.Text = "Time Left: " + ContinentBuilder.GetTimeLeft();
         if (!_buildThread.IsAlive)
         {
             if (_buildIndex != -1)
             {
                 _buildIndex++;
             }
             if (_buildIndex == -1 || _buildIndex > continentNameCB.Items.Count - 1)
             {
                 _buildStarted           = false;
                 continentNameCB.Enabled = true;
                 wowDirCB.Enabled        = false; // let this locked
                 meshTB.ReadOnly         = false;
                 button1.Enabled         = true;
                 startXBox.ReadOnly      = false;
                 startYBox.ReadOnly      = false;
                 countXBox.ReadOnly      = false;
                 countYBox.ReadOnly      = false;
                 ContinentBuilder.Reset();
                 button1.Text = "Start Build";
             }
             else
             {
                 if (_onlyOneCategory && continentNameCB.Text.Contains("------"))
                 {
                     _buildStarted           = false;
                     continentNameCB.Enabled = true;
                     wowDirCB.Enabled        = false; // let this locked
                     meshTB.ReadOnly         = false;
                     button1.Enabled         = true;
                     startXBox.ReadOnly      = false;
                     startYBox.ReadOnly      = false;
                     countXBox.ReadOnly      = false;
                     countYBox.ReadOnly      = false;
                     ContinentBuilder.Reset();
                     button1.Text = "Start Build";
                 }
                 else
                 {
                     continentNameCB.SelectedIndex = _buildIndex;
                     ContinentBuilder.Reset();
                     builderLauncher(continentNameCB.Text);
                 }
             }
         }
     }
 }
Esempio n. 4
0
        private void builderLauncher(string mapname)
        {
            if (mapname.Contains("------"))
            {
                return;
            }
            try
            {
                string continentInternalName = mapname;
                if (mapname == "AllianceGunship")
                {
                    _dungeonBuilder             = new DungeonBuilder(continentInternalName, meshTB.Text);
                    _dungeonBuilder.OnProgress += OnProgress;
                    _builder       = null;
                    _lastProgressX = 0;
                }
                else
                {
                    var wdt = new WDT("World\\Maps\\" + continentInternalName + "\\" + continentInternalName + ".wdt");
                    if (!wdt.IsValid)
                    {
                        return;
                    }

                    if (wdt.IsGlobalModel)
                    {
                        _dungeonBuilder             = new DungeonBuilder(continentInternalName, meshTB.Text);
                        _dungeonBuilder.OnProgress += OnProgress;
                        _builder       = null;
                        _lastProgressX = 0;
                    }
                    else
                    {
                        int startX = startXBox.Text.Length > 0 ? int.Parse(startXBox.Text) : 0;
                        int startY = startYBox.Text.Length > 0 ? int.Parse(startYBox.Text) : 0;
                        int countX = countXBox.Text.Length > 0 ? int.Parse(countXBox.Text) : (64 - startX);
                        int countY = countYBox.Text.Length > 0 ? int.Parse(countYBox.Text) : (64 - startY);
                        if (countX > (64 - startX))
                        {
                            countX = 64 - startX;
                        }
                        if (countY > (64 - startY))
                        {
                            countY = 64 - startY;
                        }

                        if (_buildIndex != -1) // We are building everything, then no limits
                        {
                            startX = 0;
                            startY = 0;
                            countX = 64;
                            countY = 64;
                        }

                        startXBox.Text     = startX.ToString();
                        startXBox.ReadOnly = true;
                        startYBox.Text     = startY.ToString();
                        startYBox.ReadOnly = true;
                        countXBox.Text     = countX.ToString();
                        countXBox.ReadOnly = true;
                        countYBox.Text     = countY.ToString();
                        countYBox.ReadOnly = true;

                        _builder              = new ContinentBuilder(continentInternalName, meshTB.Text, startX, startY, countX, countY);
                        _builder.OnTileEvent += OnTileEvent;
                        _dungeonBuilder       = null;
                    }
                }
                _buildStarted = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }

            this.buildDisplay1.Clear();
            continentNameCB.Enabled = false;
            wowDirCB.Enabled        = false;
            meshTB.ReadOnly         = true;
            button1.Enabled         = false;
            button1.Text            = "Building...";
            populate.Enabled        = false;

            _buildThread = new Thread(RunBuild)
            {
                IsBackground = true
            };
            _buildThread.Start();
        }