public frmNew() { InitializeComponent(); this.DialogResult = DialogResult.Cancel; m_Width = 32; m_Height = 32; // Add tile names to combobox when the window is initialized CTileLibrary cTile = new CTileLibrary(); cboDefaultTile.Items.Add("No tile"); foreach (Tile t in cTile.ObjMonde.Values) { cboDefaultTile.Items.Add(cTile.TileToTileID(t.X_Image, t.Y_Image) + "-" + t.Name); } }
/// <summary> /// Auteure : Joëlle Boyer /// Description : Changes the id of the selected tile and add it as the default tile. /// Date : 2019/11/03 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cboDefaultTile_SelectedIndexChanged(object sender, EventArgs e) { CTileLibrary cTile = new CTileLibrary(); Tile t; string myItem = cboDefaultTile.SelectedItem.ToString(); if (myItem == "No tile") { m_DefaultTile = -1; } else { myItem = myItem.Substring(myItem.IndexOf('-')).Replace("-", ""); } if (myItem != "No tile") { t = cTile.ObjMonde.FirstOrDefault(x => x.Value.Name == myItem).Value; m_DefaultTile = cTile.TileToTileID(t.X_Image, t.Y_Image); } }
/* -------------------------------------------------------------- *\ * frmMain_Load() * - Main Form Initialization \* -------------------------------------------------------------- */ private void frmMain_Load(object sender, System.EventArgs e) { m_Map = new CMap(); m_CurrentWorld = new Monde(); m_TileLibrary = new CTileLibrary(); m_Map.TileLibrary = m_TileLibrary; m_DObj = new Dictionary <ObjetMonde, string>(); m_DMonstre = new Dictionary <Monstre, string>(); m_DItem = new Dictionary <Item, string>(); m_OBJ = new List <ObjetMonde>(); m_li = new List <Item>(); m_Mons = new List <Monstre>(); picMap.Parent = picEditArea; picMap.Left = 0; picMap.Top = 0; picTiles.Parent = picEditSel; picTiles.Width = m_TileLibrary.Width * csteApplication.TILE_WIDTH_IN_IMAGE; picTiles.Height = m_TileLibrary.Height * csteApplication.TILE_HEIGHT_IN_IMAGE; picTiles.Left = 0; picTiles.Top = 0; vscMap.Minimum = 0; vscMap.Maximum = m_Map.Height; m_YSel = 0; hscMap.Minimum = 0; hscMap.Maximum = m_Map.Width; m_XSel = 0; m_bRefresh = true; m_bResize = true; timer1.Enabled = true; m_Zoom = csteApplication.ZOOM; m_TileRect = new Rectangle(-1, -1, -1, -1); m_LibRect = new Rectangle(-1, -1, -1, -1); m_ActiveTileID = 32; //dlgLoadMap.InitialDirectory = Path.GetDirectoryName(Application.ExecutablePath) + "\\maps\\"; //dlgSaveMap.InitialDirectory = dlgLoadMap.InitialDirectory; m_bOpen = false; m_MenuLogic(); //tmrLoad.Enabled = true; m_pen = new Pen(Color.Orange, 4); m_brush = new SolidBrush(Color.FromArgb(160, 249, 174, 55)); m_brush2 = new SolidBrush(Color.FromArgb(160, 255, 0, 0)); m_bDrawTileRect = false; m_bDrawMapRect = false; cboZoom.Left = 270; cboZoom.Top = 2; cboZoom.Items.Add(new ComboItem("1X", 1)); cboZoom.Items.Add(new ComboItem("2X", 2)); cboZoom.Items.Add(new ComboItem("4X", 4)); cboZoom.Items.Add(new ComboItem("8X", 8)); cboZoom.Items.Add(new ComboItem("16X", 16)); cboZoom.SelectedIndex = 1; cboZoom.DropDownStyle = ComboBoxStyle.DropDownList; lblZoom.Left = 180; lblZoom.Top = 2; tbMain.Controls.Add(lblZoom); tbMain.Controls.Add(cboZoom); }
/* -------------------------------------------------------------- *\ frmMain_Load() - Main Form Initialization \* -------------------------------------------------------------- */ private void frmMain_Load(object sender, System.EventArgs e) { //LOGIN m_Map = new CMap(); m_TileLibrary = new CTileLibrary(); m_Map.TileLibrary = m_TileLibrary; picMap.Parent = picEditArea; picMap.Left = 0; picMap.Top = 0; picTiles.Parent = picEditSel; picTiles.Width = m_TileLibrary.Width * csteApplication.TILE_WIDTH_IN_IMAGE; picTiles.Height = m_TileLibrary.Height * csteApplication.TILE_HEIGHT_IN_IMAGE; picTiles.Left = 0; picTiles.Top = 0; vscMap.Minimum = 0; vscMap.Maximum = m_Map.Height; m_YSel = 0; hscMap.Minimum = 0; hscMap.Maximum = m_Map.Width; m_XSel = 0; m_bRefresh = true; m_bResize = true; timer1.Enabled = true; m_Zoom = csteApplication.ZOOM; m_TileRect = new Rectangle(-1, -1, -1, -1); m_LibRect = new Rectangle(-1, -1, -1, -1); m_ActiveTileID = 32; //dlgLoadMap.InitialDirectory = Path.GetDirectoryName(Application.ExecutablePath) + "\\maps\\"; //dlgSaveMap.InitialDirectory = dlgLoadMap.InitialDirectory; m_bOpen = false; m_MenuLogic(); //tmrLoad.Enabled = true; m_pen = new Pen(Color.Orange, 4); m_brush = new SolidBrush(Color.FromArgb(160, 249, 174, 55)); m_brush2 = new SolidBrush(Color.FromArgb(160, 255, 0, 0)); m_bDrawTileRect = false; m_bDrawMapRect = false; comboBox1.Left = 220; comboBox1.Top = 2; comboBox1.Items.Add(new ComboItem("1X", 1)); comboBox1.Items.Add(new ComboItem("2X", 2)); comboBox1.Items.Add(new ComboItem("4X", 4)); comboBox1.Items.Add(new ComboItem("8X", 8)); comboBox1.Items.Add(new ComboItem("16X", 16)); comboBox1.SelectedIndex = 1; comboBox1.DropDownStyle = ComboBoxStyle.DropDownList; lblZoom.Left = 180; lblZoom.Top = 2; tbMain.Controls.Add(lblZoom); tbMain.Controls.Add(comboBox1); }
/* -------------------------------------------------------------- *\ frmMain_Load() - Main Form Initialization \* -------------------------------------------------------------- */ private void frmMain_Load(object sender, System.EventArgs e) { // Montre la fenetre de connexion a premier plan Presentation.frmLogin Login = new Presentation.frmLogin(); //Login.ShowDialog(); // TP HugoLand: Ajout d'un bouton "Ajouter Utilisateur" si l'utilisateur est administrateur if (Login.UserType == 1) { mnuSettings.Visible = true; mnuCreateNewUser.Enabled = true; } _db = new GameContext(); m_Map = new CMap(); m_TileLibrary = new CTileLibrary(); m_Map.TileLibrary = m_TileLibrary; picMap.Parent = picEditArea; picMap.Left = 0; picMap.Top = 0; picTiles.Parent = picEditSel; picTiles.Width = m_TileLibrary.Width * csteApplication.TILE_WIDTH_IN_IMAGE; picTiles.Height = m_TileLibrary.Height * csteApplication.TILE_HEIGHT_IN_IMAGE; picTiles.Left = 0; picTiles.Top = 0; vscMap.Minimum = 0; vscMap.Maximum = m_Map.Height; m_YSel = 0; hscMap.Minimum = 0; hscMap.Maximum = m_Map.Width; m_XSel = 0; m_bRefresh = true; m_bResize = true; tmrUpdate.Enabled = true; m_Zoom = csteApplication.ZOOM; m_TileRect = new Rectangle(-1, -1, -1, -1); m_LibRect = new Rectangle(-1, -1, -1, -1); m_ActiveTileID = 32; //dlgLoadMap.InitialDirectory = Path.GetDirectoryName(Application.ExecutablePath) + "\\maps\\"; //dlgSaveMap.InitialDirectory = dlgLoadMap.InitialDirectory; m_bOpen = false; m_MenuLogic(); //tmrLoad.Enabled = true; m_pen = new Pen(Color.Orange, 4); m_brush = new SolidBrush(Color.FromArgb(160, 249, 174, 55)); m_brush2 = new SolidBrush(Color.FromArgb(160, 255, 0, 0)); m_bDrawTileRect = false; m_bDrawMapRect = false; cboZoom.Left = 250; cboZoom.Top = 2; cboZoom.Items.Add(new ComboItem("1X", 1)); cboZoom.Items.Add(new ComboItem("2X", 2)); cboZoom.Items.Add(new ComboItem("4X", 4)); cboZoom.Items.Add(new ComboItem("8X", 8)); cboZoom.Items.Add(new ComboItem("16X", 16)); cboZoom.SelectedIndex = 1; cboZoom.DropDownStyle = ComboBoxStyle.DropDownList; lblZoom.Left = 180; lblZoom.Top = 2; tbMain.Controls.Add(lblZoom); tbMain.Controls.Add(cboZoom); }