From 08cc4fc23ae0df6659ad972d5b01c591cd49e791 Mon Sep 17 00:00:00 2001 From: Elias Leinenweber <elias.leinenweber@etu.unistra.fr> Date: Tue, 30 Mar 2021 14:43:11 +0200 Subject: [PATCH] =?UTF-8?q?Construction=20de=20refuges=20=C3=A0=20Lun?= =?UTF-8?q?=C3=A9ville?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- view/Controls/MapView.cs | 3 +-- view/Controls/TileView.cs | 6 +++++ view/FormJeu.Designer.cs | 46 +++++++++++++++++++-------------------- view/FormJeu.cs | 8 ++++++- view/FormJeu.resx | 12 +++++----- 5 files changed, 43 insertions(+), 32 deletions(-) diff --git a/view/Controls/MapView.cs b/view/Controls/MapView.cs index 775b32a..38abee5 100644 --- a/view/Controls/MapView.cs +++ b/view/Controls/MapView.cs @@ -7,6 +7,7 @@ namespace Wanderer.view.Controls { public partial class MapView : TableLayoutPanel { + public static TileView SelectedTile; private TileView[,] tileViews; [Category("Model")] @@ -18,8 +19,6 @@ namespace Wanderer.view.Controls ColumnCount = value.Tiles.GetLength(0); RowCount = value.Tiles.GetLength(1); - - tileViews = new TileView[ColumnCount, RowCount]; for(int i = 0; i < ColumnCount; i++) diff --git a/view/Controls/TileView.cs b/view/Controls/TileView.cs index ddca3a9..7902f69 100644 --- a/view/Controls/TileView.cs +++ b/view/Controls/TileView.cs @@ -18,6 +18,7 @@ namespace Wanderer.view.Controls BackColor = Color.Transparent; MouseEnter += OnMouseEnterButton1; MouseLeave += OnMouseLeaveButton1; + Click += OnClick; //Image = imageFromTerrain(); } @@ -31,6 +32,11 @@ namespace Wanderer.view.Controls this.FlatAppearance.BorderColor = Color.Black; } + private void OnClick(object sender, EventArgs e) + { + MapView.SelectedTile = this; + } + private Image imageFromTerrain() { switch (model.Terrain) diff --git a/view/FormJeu.Designer.cs b/view/FormJeu.Designer.cs index 46edd42..d7b91b6 100644 --- a/view/FormJeu.Designer.cs +++ b/view/FormJeu.Designer.cs @@ -43,15 +43,15 @@ namespace Wanderer.view this.btnChemin = new System.Windows.Forms.Button(); this.btnClub = new System.Windows.Forms.Button(); this.mapView1 = new Wanderer.view.Controls.MapView(); - ((System.ComponentModel.ISupportInitialize)(this.pbAide)).BeginInit(); + ((System.ComponentModel.ISupportInitialize) (this.pbAide)).BeginInit(); this.panel1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.pbPersonnes)).BeginInit(); + ((System.ComponentModel.ISupportInitialize) (this.pictureBox1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize) (this.pbPersonnes)).BeginInit(); this.SuspendLayout(); // // pbAide // - this.pbAide.Image = ((System.Drawing.Image)(resources.GetObject("pbAide.Image"))); + this.pbAide.Image = ((System.Drawing.Image) (resources.GetObject("pbAide.Image"))); this.pbAide.Location = new System.Drawing.Point(8, 10); this.pbAide.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3); this.pbAide.Name = "pbAide"; @@ -118,7 +118,7 @@ namespace Wanderer.view // // pbPersonnes // - this.pbPersonnes.Image = ((System.Drawing.Image)(resources.GetObject("pbPersonnes.Image"))); + this.pbPersonnes.Image = ((System.Drawing.Image) (resources.GetObject("pbPersonnes.Image"))); this.pbPersonnes.Location = new System.Drawing.Point(1048, 19); this.pbPersonnes.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3); this.pbPersonnes.Name = "pbPersonnes"; @@ -134,10 +134,10 @@ namespace Wanderer.view this.btnUsine.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnUsine.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F); this.btnUsine.ForeColor = System.Drawing.Color.White; - this.btnUsine.Image = ((System.Drawing.Image)(resources.GetObject("btnUsine.Image"))); + this.btnUsine.Image = ((System.Drawing.Image) (resources.GetObject("btnUsine.Image"))); this.btnUsine.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; this.btnUsine.Location = new System.Drawing.Point(1080, 603); - this.btnUsine.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.btnUsine.Margin = new System.Windows.Forms.Padding(2); this.btnUsine.Name = "btnUsine"; this.btnUsine.Size = new System.Drawing.Size(167, 77); this.btnUsine.TabIndex = 5; @@ -153,10 +153,10 @@ namespace Wanderer.view this.btnTrain.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnTrain.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F); this.btnTrain.ForeColor = System.Drawing.Color.White; - this.btnTrain.Image = ((System.Drawing.Image)(resources.GetObject("btnTrain.Image"))); + this.btnTrain.Image = ((System.Drawing.Image) (resources.GetObject("btnTrain.Image"))); this.btnTrain.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; this.btnTrain.Location = new System.Drawing.Point(819, 603); - this.btnTrain.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.btnTrain.Margin = new System.Windows.Forms.Padding(2); this.btnTrain.Name = "btnTrain"; this.btnTrain.Size = new System.Drawing.Size(167, 77); this.btnTrain.TabIndex = 6; @@ -172,10 +172,10 @@ namespace Wanderer.view this.btnRefuge.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnRefuge.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F); this.btnRefuge.ForeColor = System.Drawing.Color.White; - this.btnRefuge.Image = ((System.Drawing.Image)(resources.GetObject("btnRefuge.Image"))); + this.btnRefuge.Image = ((System.Drawing.Image) (resources.GetObject("btnRefuge.Image"))); this.btnRefuge.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; this.btnRefuge.Location = new System.Drawing.Point(29, 603); - this.btnRefuge.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.btnRefuge.Margin = new System.Windows.Forms.Padding(2); this.btnRefuge.Name = "btnRefuge"; this.btnRefuge.Size = new System.Drawing.Size(167, 77); this.btnRefuge.TabIndex = 7; @@ -191,10 +191,10 @@ namespace Wanderer.view this.btnChemin.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnChemin.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F); this.btnChemin.ForeColor = System.Drawing.Color.White; - this.btnChemin.Image = ((System.Drawing.Image)(resources.GetObject("btnChemin.Image"))); + this.btnChemin.Image = ((System.Drawing.Image) (resources.GetObject("btnChemin.Image"))); this.btnChemin.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; this.btnChemin.Location = new System.Drawing.Point(281, 603); - this.btnChemin.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.btnChemin.Margin = new System.Windows.Forms.Padding(2); this.btnChemin.Name = "btnChemin"; this.btnChemin.Size = new System.Drawing.Size(167, 77); this.btnChemin.TabIndex = 8; @@ -209,10 +209,10 @@ namespace Wanderer.view this.btnClub.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnClub.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F); this.btnClub.ForeColor = System.Drawing.Color.White; - this.btnClub.Image = ((System.Drawing.Image)(resources.GetObject("btnClub.Image"))); + this.btnClub.Image = ((System.Drawing.Image) (resources.GetObject("btnClub.Image"))); this.btnClub.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; this.btnClub.Location = new System.Drawing.Point(556, 603); - this.btnClub.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.btnClub.Margin = new System.Windows.Forms.Padding(2); this.btnClub.Name = "btnClub"; this.btnClub.Size = new System.Drawing.Size(167, 77); this.btnClub.TabIndex = 9; @@ -223,13 +223,13 @@ namespace Wanderer.view // mapView1 // this.mapView1.AutoScroll = true; - this.mapView1.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("mapView1.BackgroundImage"))); + this.mapView1.BackgroundImage = ((System.Drawing.Image) (resources.GetObject("mapView1.BackgroundImage"))); this.mapView1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; this.mapView1.ColumnCount = 2; this.mapView1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); this.mapView1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); this.mapView1.Location = new System.Drawing.Point(29, 104); - this.mapView1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.mapView1.Margin = new System.Windows.Forms.Padding(2); this.mapView1.Name = "mapView1"; this.mapView1.RowCount = 2; this.mapView1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 13.81032F)); @@ -243,7 +243,7 @@ namespace Wanderer.view // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage"))); + this.BackgroundImage = ((System.Drawing.Image) (resources.GetObject("$this.BackgroundImage"))); this.ClientSize = new System.Drawing.Size(1282, 720); this.Controls.Add(this.mapView1); this.Controls.Add(this.btnClub); @@ -253,19 +253,19 @@ namespace Wanderer.view this.Controls.Add(this.btnUsine); this.Controls.Add(this.panel1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; - this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.Icon = ((System.Drawing.Icon) (resources.GetObject("$this.Icon"))); this.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3); this.Name = "FormJeu"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "FormJeu"; + this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.FormJeu_FormClosed); this.Load += new System.EventHandler(this.FormJeu_Load); - ((System.ComponentModel.ISupportInitialize)(this.pbAide)).EndInit(); + ((System.ComponentModel.ISupportInitialize) (this.pbAide)).EndInit(); this.panel1.ResumeLayout(false); this.panel1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.pbPersonnes)).EndInit(); + ((System.ComponentModel.ISupportInitialize) (this.pictureBox1)).EndInit(); + ((System.ComponentModel.ISupportInitialize) (this.pbPersonnes)).EndInit(); this.ResumeLayout(false); - } #endregion diff --git a/view/FormJeu.cs b/view/FormJeu.cs index 1f26e5f..9ef749d 100644 --- a/view/FormJeu.cs +++ b/view/FormJeu.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using Wanderer.view.Controls; namespace Wanderer.view { @@ -35,7 +36,7 @@ namespace Wanderer.view private void btnRefuge_Click(object sender, EventArgs e) { - + MapView.SelectedTile.Image = btnRefuge.Image; } private void mapView1_Paint(object sender, PaintEventArgs e) @@ -56,5 +57,10 @@ namespace Wanderer.view { mapView1.Model = new Map(20,10); } + + private void FormJeu_FormClosed(object sender, FormClosedEventArgs e) + { + Application.Exit(); + } } } diff --git a/view/FormJeu.resx b/view/FormJeu.resx index f4e2659..34cf0cd 100644 --- a/view/FormJeu.resx +++ b/view/FormJeu.resx @@ -963,7 +963,7 @@ <data name="pbPersonnes.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <value> iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAB - 2AAAAdgB+lymcgAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAYBSURBVHhe7ZlL + 1wAAAdcBjJIIaAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAYBSURBVHhe7ZlL qFVVGMe3b/EthChkSANF0DQEJ4YDUTFq0EgaCBoEmahgOEgIrIGPhg0EySbOahDVoOgFkaggTYweox4W FERBNKig1+3/2/f7Tuus/Z3H9uxz8dD+ww/W+h5rr/Xde9bee+1iampqRpFWiWfEG+I7gza2VVHOOAmN 40LaL34UdCLw7Y9yx0VoHAfSKVskfCJOiB0GbWzuPxWNMQ5CY9NIW8QftrizYn4QM998dIjdkseMg9DY @@ -995,7 +995,7 @@ <data name="btnUsine.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <value> iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAB - uwAAAbsBOuzj4gAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAAUdEVYdFRpdGxl + ugAAAboB6KsBBgAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAAUdEVYdFRpdGxl ADAwNSAtIEZhY3Rvcnkgdf3kTgAACZtJREFUeF7tmX9QVNcVx7dx2qaTTn9k0hqNyZipFVbQKP4KK1qn ll2wiBZYg4DRaWqMTpsxzQ9tJyo1KWMTZXchoTHRaKxWQwqKGmVZcHdFURBBfminY5RlF5GgQdBJ/ZHI 7TkPHt5339mVwC6I9o+Psuee++75ft999963q2GM3RVsttc9mLH/wk8y9jcMyyhy/8xkc2nxfyr3XXvz @@ -1043,7 +1043,7 @@ <data name="btnTrain.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <value> iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAB - 2AAAAdgB+lymcgAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAhISURBVHhezZj7 + 1wAAAdcBjJIIaAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAhISURBVHhezZj7 U1RlGMeb7D79Xs30B5QQwXpld0EEVGBBAV2rmexClgoFUy3mrUJrKLugMmjTmJozabhqmZSlLKzsrrsL knERRoGKVJamJkunnJLi6X2P77tzLs/ZC3vOLs/MZ4Y55z3v9/s85/I8y016RaAowxCwZKwbKTQ3jRZm DAaKzH8ECs0QEWQtvYZeGyg0rR1ZmJnGtp3cMZiff3vAYn6O0IcmFhtnSVGX91mTbmNykysCBeY8cueG @@ -1085,7 +1085,7 @@ <data name="btnRefuge.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <value> iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAB - 2AAAAdgB+lymcgAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAcQSURBVHhe7Vjd + 1wAAAdcBjJIIaAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAcQSURBVHhe7Vjd T1RHFMfGYk0fWpBt6n/QhzZpm1QffG6iUXySKoVdP4iw2JqotVpr1BXYBUIrLakaqraNmKYifmxa2/Ih WDWmCDatSIjKR+OC1YA8aSUNcHrO3RmYHWYvd+/cC37wS37h3rlzZ845c8753SVpBjNwH2sCa17wBvMv ekP+C3TNhp8doOOlSCD6gnklbPjZgDeUuxAdH0aOMuJ17kL22FF4y/yv4PqtyBa6ZsPTh40VG+d4Q3nX @@ -1122,7 +1122,7 @@ <data name="btnChemin.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <value> iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAB - 2AAAAdgB+lymcgAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAwbSURBVHhexZoL + 1wAAAdcBjJIIaAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAwbSURBVHhexZoL VFP3HceZfa5dXR/rFKuAg9Z2dd2q6+ljWwWCOFcJjzYiCSSpCpUEkmhd7dNDbdfTh3a+unYHkK0FtEyM uBZMgqWtUHygWEnQc1y3Pq1dq+QmgJ2t/Pf7J79cb+7950kI33M+R7z/1+/7v//7f0FCJEqp016eZlYX p+7QqKc2KX6Ij8dV81srJ+ZaTUvlVqMivaPqYnw8Nko1a2xpOzQEeS+BJPwAk8ZFYP6yXKuxDyAebIZ6 @@ -1180,7 +1180,7 @@ <data name="btnClub.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <value> iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAB - 2AAAAdgB+lymcgAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAXmSURBVHhe7Vpt + 1wAAAdcBjJIIaAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAXmSURBVHhe7Vpt TBxVFN2Y2Bh/mBhNTdgCu4vRVmwwEZGqtLszaPyIsbZgAuy2S6W7MyARMbF+JUAUAQsULI36pxAWa2VL q5ICRhutgcYmVeqPmsb+MJoirUFraENtG/p8d7izjG8vFFhkZ5o9yQnLzHnn3nt25u3wYUsggf8XDlld 75TUb5y56l9OWWVz4pT2a0du2TNoY004ZWVX1HDzZW7pTrSzFvg7v5kcaCGUFB/aWge88R+nB1BZ8sM+ -- GitLab