/// <summary> /// Creer une map dans le programme /// </summary> /// <param name="bnew">Nouvelle map (bd) ou load</param> private void NewMap(bool bnew) { bool bResult; m_bOpen = false; picMap.Visible = false; this.Cursor = Cursors.WaitCursor; if (!bnew || NewmapFrm()) { try { if (!bnew) { bResult = m_Map.CreateNew(int.Parse(CurrentWorld.LimiteX), int.Parse(CurrentWorld.LimiteY), defaulttileid); } else { bResult = m_Map.CreateNew(_frmnew.Width, _frmnew.Height, defaulttileid); } if (bResult) { if (bnew) { AddMaptoModel(_frmnew.MapWidth, _frmnew.MapHeight, _frmnew.Desc); } m_bOpen = true; m_bRefresh = true; m_bResize = true; picMap.Visible = true; } } catch { Console.WriteLine("Error Creating..."); } m_MenuLogic(); this.Cursor = Cursors.Default; } }
/* -------------------------------------------------------------- *\ * m_NewMap() * * - Creates a new map of the selected size. \* -------------------------------------------------------------- */ private void NewMap() { frmNew f; DialogResult result; bool bResult; f = new frmNew(); m_DObj.Clear(); m_DMonstre.Clear(); m_DItem.Clear(); m_OBJ.Clear(); m_li.Clear(); m_Mons.Clear(); m_CurrentWorld = null; m_CurrentWorld = new Monde(); f.MapWidth = m_Map.Width; f.MapHeight = m_Map.Height; f.MapDescription = m_Map.Description; result = f.ShowDialog(this); if (result == DialogResult.OK) { m_bOpen = false; picMap.Visible = false; this.Cursor = Cursors.WaitCursor; try { bResult = m_Map.CreateNew(f.MapWidth, f.MapHeight, f.MapDescription, 32); m_CurrentWorld.LimiteX = m_Map.Width; m_CurrentWorld.LimiteY = m_Map.Height; m_CurrentWorld.Description = m_Map.Description; m_worldNew = true; if (bResult) { m_bOpen = true; m_bRefresh = true; m_bResize = true; picMap.Visible = true; } } catch { Console.WriteLine("Error Creating..."); } m_MenuLogic(); this.Cursor = Cursors.Default; } }
/* -------------------------------------------------------------- *\ * m_NewMap() * * - Creates a new map of the selected size. \* -------------------------------------------------------------- */ private void NewMap() { frmNew f; DialogResult result; bool bResult; f = new frmNew(); f.MapWidth = m_Map.Width; f.MapHeight = m_Map.Height; f.DefaultTile = m_Map.DefaultTileID; result = f.ShowDialog(this); if (result == DialogResult.OK) { m_bOpen = false; picMap.Visible = false; this.Cursor = Cursors.WaitCursor; try { bResult = m_Map.CreateNew(f.MapWidth, f.MapHeight, f.DefaultTile); if (bResult) { m_bOpen = true; m_bRefresh = true; m_bResize = true; picMap.Visible = true; } } catch { Console.WriteLine("Error Creating..."); } m_MenuLogic(); world = f.MyWorld; this.Cursor = Cursors.Default; } else { MessageBox.Show("You have cancelled the creation of a new world.", "Cancelled", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }