diff --git a/model/Map.cs b/model/Map.cs index e4d7f20bc5576206a0da2cad748bf15b2b32c28f..7b4c2604e1158c1e2fd84e1c5cd8b8b8b63891a9 100644 --- a/model/Map.cs +++ b/model/Map.cs @@ -1,9 +1,16 @@ -namespace Wanderer +using Wanderer.model; + +namespace Wanderer { public class Map { private Tile[,] _tiles; + public Map(int dx, int dy) + { + _tiles = new Tile[dx, dy]; + } + public Tile[,] Tiles { get => _tiles; diff --git a/model/Tile.cs b/model/Tile.cs index ed086789535ff5781727d1165ae3504b9eda884c..3d8d3f4146070acc948ac6b81de2d2e3c4a095f5 100644 --- a/model/Tile.cs +++ b/model/Tile.cs @@ -1,7 +1,14 @@ -namespace Wanderer +namespace Wanderer.model { public class Tile { + private Terrain _terrain; + + public Tile(Terrain terrain) + { + _terrain = terrain; + } + public Terrain Terrain { get; set; } } } \ No newline at end of file diff --git a/view/Controls/MapView.cs b/view/Controls/MapView.cs index a28db89e69f8a592ce8036776c9a96c2bdab5137..3519c744f66fa44b3891f8543b26e5df0a6b4a59 100644 --- a/view/Controls/MapView.cs +++ b/view/Controls/MapView.cs @@ -9,7 +9,7 @@ namespace Wanderer.view.Controls { private TileView[,] tileViews; - [Category("Model")] + [Category("Data")] [Browsable(true)] [Description("La map correspondante.")] [Editor(typeof(WindowsFormsComponentEditor), typeof(UITypeEditor))] @@ -18,6 +18,15 @@ namespace Wanderer.view.Controls ColumnCount = value.Tiles.GetLength(0); RowCount = value.Tiles.GetLength(1); + for (int i = 0; i < ColumnCount; i++) { + ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100)); + } + + for (int i = 0; i < RowCount; i++) { + RowStyles.Add(new RowStyle(SizeType.Percent, 100)); + } + + tileViews = new TileView[ColumnCount, RowCount]; for (int i = 0; i < ColumnCount; ++i) for (int j = 0; j < RowCount; ++j) { @@ -30,6 +39,8 @@ namespace Wanderer.view.Controls public MapView() { InitializeComponent(); + + CellBorderStyle = TableLayoutPanelCellBorderStyle.Inset; } } } \ No newline at end of file diff --git a/view/Controls/TileView.cs b/view/Controls/TileView.cs index 7f3331768bf6327152baa1483f796c011335370b..1d24612a8f255fee9285e0ea83c8e1d4a0caf87e 100644 --- a/view/Controls/TileView.cs +++ b/view/Controls/TileView.cs @@ -1,5 +1,6 @@ using System.Drawing; using System.Windows.Forms; +using Wanderer.model; namespace Wanderer.view.Controls { @@ -10,7 +11,8 @@ namespace Wanderer.view.Controls public TileView(Tile tile) { model = tile; - Image = imageFromTerrain(); + Size = new Size(50, 50); + //Image = imageFromTerrain(); } private Image imageFromTerrain() diff --git a/view/FormJeu.Designer.cs b/view/FormJeu.Designer.cs index b6a04771ea1f098940e1c0cf034618d8c2f71a0a..7a138a925b2ff8fc310a60db617a5f0f42659e7a 100644 --- a/view/FormJeu.Designer.cs +++ b/view/FormJeu.Designer.cs @@ -39,17 +39,17 @@ namespace Wanderer.view this.btnClub = new System.Windows.Forms.Button(); this.pbPersonnes = new System.Windows.Forms.PictureBox(); this.mapView1 = new Wanderer.view.Controls.MapView(); - ((System.ComponentModel.ISupportInitialize)(this.pbAide)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.pbPersonnes)).BeginInit(); + ((System.ComponentModel.ISupportInitialize) (this.pbAide)).BeginInit(); + ((System.ComponentModel.ISupportInitialize) (this.pbPersonnes)).BeginInit(); this.SuspendLayout(); // // pbAide // - this.pbAide.Image = ((System.Drawing.Image)(resources.GetObject("pbAide.Image"))); - this.pbAide.Location = new System.Drawing.Point(14, 15); - this.pbAide.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.pbAide.Image = ((System.Drawing.Image) (resources.GetObject("pbAide.Image"))); + this.pbAide.Location = new System.Drawing.Point(9, 10); + this.pbAide.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3); this.pbAide.Name = "pbAide"; - this.pbAide.Size = new System.Drawing.Size(63, 61); + this.pbAide.Size = new System.Drawing.Size(42, 40); this.pbAide.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.pbAide.TabIndex = 0; this.pbAide.TabStop = false; @@ -57,19 +57,20 @@ namespace Wanderer.view // // panel1 // - this.panel1.Location = new System.Drawing.Point(123, 12); - this.panel1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.panel1.Location = new System.Drawing.Point(82, 8); + this.panel1.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(680, 70); + this.panel1.Size = new System.Drawing.Size(453, 46); this.panel1.TabIndex = 1; // // btnUsine // - 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(739, 450); + this.btnUsine.Location = new System.Drawing.Point(493, 292); + this.btnUsine.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.btnUsine.Name = "btnUsine"; - this.btnUsine.Size = new System.Drawing.Size(149, 77); + this.btnUsine.Size = new System.Drawing.Size(99, 50); this.btnUsine.TabIndex = 5; this.btnUsine.Text = "Usine"; this.btnUsine.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -78,11 +79,12 @@ namespace Wanderer.view // // btnTrain // - 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(198, 450); + this.btnTrain.Location = new System.Drawing.Point(132, 292); + this.btnTrain.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.btnTrain.Name = "btnTrain"; - this.btnTrain.Size = new System.Drawing.Size(149, 77); + this.btnTrain.Size = new System.Drawing.Size(99, 50); this.btnTrain.TabIndex = 6; this.btnTrain.Text = "Train"; this.btnTrain.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -91,11 +93,12 @@ namespace Wanderer.view // // btnRefuge // - 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(14, 450); + this.btnRefuge.Location = new System.Drawing.Point(9, 292); + this.btnRefuge.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.btnRefuge.Name = "btnRefuge"; - this.btnRefuge.Size = new System.Drawing.Size(149, 77); + this.btnRefuge.Size = new System.Drawing.Size(99, 50); this.btnRefuge.TabIndex = 7; this.btnRefuge.Text = "Refuge"; this.btnRefuge.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -104,11 +107,12 @@ namespace Wanderer.view // // btnChemin // - 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(387, 450); + this.btnChemin.Location = new System.Drawing.Point(258, 292); + this.btnChemin.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.btnChemin.Name = "btnChemin"; - this.btnChemin.Size = new System.Drawing.Size(149, 77); + this.btnChemin.Size = new System.Drawing.Size(99, 50); this.btnChemin.TabIndex = 8; this.btnChemin.Text = "Chemins"; this.btnChemin.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -116,11 +120,12 @@ namespace Wanderer.view // // btnClub // - 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(567, 450); + this.btnClub.Location = new System.Drawing.Point(378, 292); + this.btnClub.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.btnClub.Name = "btnClub"; - this.btnClub.Size = new System.Drawing.Size(149, 77); + this.btnClub.Size = new System.Drawing.Size(99, 50); this.btnClub.TabIndex = 9; this.btnClub.Text = "Club"; this.btnClub.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -128,11 +133,11 @@ namespace Wanderer.view // // pbPersonnes // - this.pbPersonnes.Image = ((System.Drawing.Image)(resources.GetObject("pbPersonnes.Image"))); - this.pbPersonnes.Location = new System.Drawing.Point(809, 16); - this.pbPersonnes.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.pbPersonnes.Image = ((System.Drawing.Image) (resources.GetObject("pbPersonnes.Image"))); + this.pbPersonnes.Location = new System.Drawing.Point(539, 10); + this.pbPersonnes.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3); this.pbPersonnes.Name = "pbPersonnes"; - this.pbPersonnes.Size = new System.Drawing.Size(34, 35); + this.pbPersonnes.Size = new System.Drawing.Size(23, 23); this.pbPersonnes.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.pbPersonnes.TabIndex = 10; this.pbPersonnes.TabStop = false; @@ -142,20 +147,21 @@ namespace Wanderer.view 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(14, 102); + this.mapView1.Location = new System.Drawing.Point(9, 66); + this.mapView1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.mapView1.Name = "mapView1"; this.mapView1.RowCount = 2; this.mapView1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); this.mapView1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.mapView1.Size = new System.Drawing.Size(874, 329); + this.mapView1.Size = new System.Drawing.Size(583, 214); this.mapView1.TabIndex = 11; this.mapView1.Paint += new System.Windows.Forms.PaintEventHandler(this.mapView1_Paint); // // FormJeu // - this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(900, 562); + this.ClientSize = new System.Drawing.Size(600, 365); this.Controls.Add(this.mapView1); this.Controls.Add(this.pbPersonnes); this.Controls.Add(this.btnClub); @@ -165,14 +171,14 @@ namespace Wanderer.view this.Controls.Add(this.btnUsine); this.Controls.Add(this.panel1); this.Controls.Add(this.pbAide); - this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3); this.Name = "FormJeu"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "FormJeu"; - ((System.ComponentModel.ISupportInitialize)(this.pbAide)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.pbPersonnes)).EndInit(); + this.Load += new System.EventHandler(this.FormJeu_Load); + ((System.ComponentModel.ISupportInitialize) (this.pbAide)).EndInit(); + ((System.ComponentModel.ISupportInitialize) (this.pbPersonnes)).EndInit(); this.ResumeLayout(false); - } #endregion diff --git a/view/FormJeu.cs b/view/FormJeu.cs index a6f147ff50214a20baa8bd32052a970685a9813b..20e098673aa57746c739a3b594ab2bbd95d308a4 100644 --- a/view/FormJeu.cs +++ b/view/FormJeu.cs @@ -41,5 +41,10 @@ namespace Wanderer.view private void mapView1_Paint(object sender, PaintEventArgs e) { } + + private void FormJeu_Load(object sender, EventArgs e) + { + mapView1.Model = new Map(10, 10); + } } } diff --git a/view/FormJeu.resx b/view/FormJeu.resx index 0c97d1451ccb724ecbe21621ea14ff50ea5a7d40..65113246ae51a41cdc1aedbc295323b28e322030 100644 --- a/view/FormJeu.resx +++ b/view/FormJeu.resx @@ -963,7 +963,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 @@ -1011,7 +1011,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 @@ -1053,7 +1053,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 @@ -1090,7 +1090,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 @@ -1148,7 +1148,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+ @@ -1180,7 +1180,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