Exemple #1
0
        private void btnRegenPrev_Click(object sender, EventArgs e)
        {
            Map thisMap = null;

            foreach (var m in _maps) {
                if (m.MapName == (string)lstMaps.SelectedItem) {
                    thisMap = m;
                    break;
                }
            }
            var fileWriter = new StreamWriter("LUA\\GUI_Control.lua");

            if (thisMap != null)
            {
                fileWriter.WriteLine("Map_Action_Add_Save(" + thisMap.MapId + ")");
                fileWriter.Close();

                Thread.Sleep(3000); // -- Attempt to prevent map resizing..

                var mymap = new D3Map();
                mymap.ReadConfig(thisMap.MapDirectory + "\\Config.txt");
                mymap.LoadBlockColors("Data\\Block.txt");
                mymap.Unzip(thisMap.MapDirectory + "\\Data-Layer.gz");

                if ((string)dropOverType.SelectedItem == "ISO") {
                    var mgen = new Thread(mymap.generate_iso);
                    mgen.Start();
                } else if ((string)dropOverType.SelectedItem == "2D") {
                    var mapGen = new Thread(mymap.generate_Heightmap); // -- Only 2d requires Heightmap
                    mapGen.Start();
                    mapGen.Join(2000);

                    var mgen = new Thread(mymap.generate_2D);
                    mgen.Start();
                } else {
                    MessageBox.Show("Please select and overview type.");
                    return;
                }
                _isoMap = mymap;
                _tempMap = thisMap;
            }
            lblGen.Text = "Generating...";
            var wait = new Thread(Waiter);
            wait.Start();
        }
Exemple #2
0
        private void Waiter()
        {
            while (_isoMap.GeneratedImage == null) {
            }

            picOverview.Image = _isoMap.GeneratedImage;
            lblGen.Text = "Generated in " + _isoMap.Time2D + _isoMap.Time3D + "s";
            _isoMap.Time2D = "";
            _isoMap.Time3D = "";
            _tempMap.Preview = _isoMap.GeneratedImage;
            _tempMap = null;
            GC.Collect();
        }
Exemple #3
0
        private void loadMapConfig(Map map)
        {
            StreamReader fileReader;
            try {
                 fileReader = new StreamReader(map.MapDirectory + "Config.txt");
            } catch {
                return;
            }

            do
            {
                string line = fileReader.ReadLine();

                if (line.Contains("=")) {
                    var command = line.Substring(0, line.IndexOf(" "));
                    var value = line.Substring(line.IndexOf("=") + 2, line.Length - (line.IndexOf("=") + 2));

                    switch (command) {
                        case "Server_Version":
                            map.MapVersion = value;
                            break;
                        case "Unique_ID":
                            map.UniqueId = value;
                            break;
                        case "Rank_Build":
                            map.RankBuild = value;
                            break;
                        case "Rank_Join":
                            map.RankJoin = value;
                            break;
                        case "Rank_Show":
                            map.RankShow = value;
                            break;
                        case "Physic_Stopped":
                            map.Physics = value;
                            break;
                        case "MOTD_Override":
                            map.Motd = value;
                            break;
                        case "Save_Intervall":
                            map.SaveInt = value;
                            break;
                        case "Overview_Type":
                            map.Overview = value;
                            break;
                        case "Size_X":
                            map.SizeX = value;
                            break;
                        case "Size_Y":
                            map.SizeY = value;
                            break;
                        case "Size_Z":
                            map.SizeZ = value;
                            break;
                        case "Spawn_X":
                            map.Spawnx = value;
                            break;
                        case "Spawn_Y":
                            map.Spawny = value;
                            break;
                        case "Spawn_Z":
                            map.Spawnz = value;
                            break;
                        case "Spawn_Rot":
                            map.Spawnrot = value;
                            break;
                        case "Spawn_Look":
                            map.Spawnlook = value;
                            break;
                    }
                }
            } while (!fileReader.EndOfStream);
            fileReader.Close();
        }
Exemple #4
0
 private void saveMapSettings(Map map)
 {
     var sw = new StreamWriter(map.MapDirectory + "/Config.txt");
     sw.WriteLine("Server_Version = " + map.MapVersion);
     sw.WriteLine("Unique_ID = " + map.UniqueId);
     sw.WriteLine("Name = " + map.MapName);
     sw.WriteLine("Rank_Build = " + map.RankBuild);
     sw.WriteLine("Rank_Join = " + map.RankJoin);
     sw.WriteLine("Rank_Show = " + map.RankShow);
     sw.WriteLine("Physic_Stopped = " + map.Physics);
     sw.WriteLine("MOTD_Override = " + map.Motd);
     sw.WriteLine("Save_Intervall = " + map.SaveInt);
     sw.WriteLine("Overview_Type = " + map.Overview);
     sw.WriteLine("Size_X = " + map.SizeX);
     sw.WriteLine("Size_Y = " + map.SizeY);
     sw.WriteLine("Size_Z = " + map.SizeZ);
     sw.WriteLine("Spawn_X = " + map.Spawnx);
     sw.WriteLine("Spawn_Y = " + map.Spawny);
     sw.WriteLine("Spawn_Z = " + map.Spawnz);
     sw.WriteLine("Spawn_Rot = " + map.Spawnrot);
     sw.WriteLine("Spawn_Look = " + map.Spawnlook);
     sw.Close();
 }
Exemple #5
0
 private void waiter()
 {
     while (isoMap.generatedImage == null) {
         continue;
     }
     picOverview.Image = isoMap.generatedImage;
     lblGen.Text = "Generated in " + isoMap.time2d + isoMap.time3d + "s";
     isoMap.time2d = "";
     isoMap.time3d = "";
     tempMap.preview = isoMap.generatedImage;
     // isoMap.generatedImage.Dispose();
     //    isoMap = null;
     tempMap = null;
     GC.Collect();
 }