Example #1
0
 string[] BuildMap_lua()
 {
     MapSettings dlg = new MapSettings(Map_name, Tileset_save_name);
     if (dlg.ShowDialog() == DialogResult.Cancel) return new string[1] {"cancelled"};
     Map_name = dlg.RET[0];
     Tileset_save_name = dlg.RET[1];
     string str = "";
     string[] res = BasicMap.GetMap;
     for (int i = 0; i < res.Length; i++)
     {
         switch (res[i])
         {
             case "rnd_encounter = ":
                 res[i] = res[i] + RndEnc.ToString();
                 break;
             case "monsters = {":
                 if (RndEnc)
                 {
                     string str_ = "";
                     for (int ii = 0; ii < RndEncStr.Count; ii++)
                     {
                         string a = " \"";
                         if (ii != 0) a = "\", \"";
                         str_ = str_ + a + RndEncStr[ii];
                     }
                     str_ = str_ + "\" }";
                     res[i] = res[i] + str_;
                 }
                 else
                 { res[i] = res[i] + "}"; }
                 break;
             case "map_width = ":
                 res[i] = res[i] + panel_map.Width;
                 break;
             case "map_height = ":
                 res[i] = res[i] + panel_map.Height;
                 break;
             case "tileset_id = \"":
                 res[i] = res[i] + Tileset_save_name + "\"";
                 break;
             case "t = Graphics.loadImage(System.currentDirectory()..\"/tilesets/":
                 res[i] = res[i] + Tileset_save_name + ".png\")";
                 break;
             case "level1 = {":
                 str = "";
                 for (int ii = 0; ii < MapTiles.Count; ii++)
                 {
                     string a = " ";
                     if (ii != 0) a = ", ";
                     str = str + a + MapTiles[ii].num[0].ToString();
                 }
                 str = str + " }";
                 res[i] = res[i] + str;
                 break;
             case "level2 = {":
                 str = "";
                 for (int ii = 0; ii < MapTiles.Count; ii++)
                 {
                     string a = " ";
                     if (ii != 0) a = ", ";
                     str = str + a + MapTiles[ii].num[1].ToString();
                 }
                 str = str + " }";
                 res[i] = res[i] + str;
                 break;
             case "level3 = {":
                 str = "";
                 for (int ii = 0; ii < MapTiles.Count; ii++)
                 {
                     string a = " ";
                     if (ii != 0) a = ", ";
                     str = str + a + MapTiles[ii].num[2].ToString();
                 }
                 str = str + " }";
                 res[i] = res[i] + str;
                 break;
             case "map_table = {":
                 str = "";
                 for (int ii = 0; ii < MapTiles.Count; ii++)
                 {
                     string a = " ";
                     if (ii != 0) a = ", ";
                     str = str + a + MapTiles[ii].collision.ToString();
                 }
                 str = str + " }";
                 res[i] = res[i] + str;
                 break;
         }
     }
     return res;
 }
Example #2
0
 private void button7_Click(object sender, EventArgs e)
 {
     if (label2.Text.ToLower().Contains("maps"))
     {
         MapEditor.MapSettings sett = new MapEditor.MapSettings("","");
         sett.label2.Visible = false;
         sett.textBox2.Visible = false;
         sett.ShowDialog();
         MapEditor.MapEditor editor = new MapEditor.MapEditor();
         OpenFileDialog opn = new OpenFileDialog();
         opn.Title = "Load a tileset";
         if (opn.ShowDialog() == DialogResult.OK)
         {
             editor.load_tiles(opn.FileName);
             editor.groupBox1.Visible = true;
             editor.Map_name = sett.RET[0];
         }
         else return;
         editor.Show();
     }
 }