From f7c53542052b271e367cf81324034a56d4f7d19e Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 8 Feb 2017 18:19:09 -0500 Subject: [PATCH] Fix shop editor --- .../Applications/MUDControlCentre.Designer.cs | 16 ++++++++++++- .../Applications/MUDControlCentre.cs | 24 ++++++++++++++++++- .../Applications/MUDControlCentre.resx | 6 ++--- 3 files changed, 41 insertions(+), 5 deletions(-) diff --git a/ShiftOS.WinForms/Applications/MUDControlCentre.Designer.cs b/ShiftOS.WinForms/Applications/MUDControlCentre.Designer.cs index cced521..9539632 100644 --- a/ShiftOS.WinForms/Applications/MUDControlCentre.Designer.cs +++ b/ShiftOS.WinForms/Applications/MUDControlCentre.Designer.cs @@ -145,6 +145,7 @@ namespace ShiftOS.WinForms.Applications this.btnedititem = new System.Windows.Forms.Button(); this.txtshopname = new System.Windows.Forms.TextBox(); this.txtshopdescription = new System.Windows.Forms.TextBox(); + this.btneditshop = new System.Windows.Forms.Button(); this.menuStrip1.SuspendLayout(); this.statusStrip1.SuspendLayout(); this.toolStripContainer1.BottomToolStripPanel.SuspendLayout(); @@ -332,8 +333,8 @@ namespace ShiftOS.WinForms.Applications // // toolStripContainer1.ContentPanel // - this.toolStripContainer1.ContentPanel.Controls.Add(this.shop_editor); this.toolStripContainer1.ContentPanel.Controls.Add(this.shop_view); + this.toolStripContainer1.ContentPanel.Controls.Add(this.shop_editor); this.toolStripContainer1.ContentPanel.Controls.Add(this.shop_all); this.toolStripContainer1.ContentPanel.Controls.Add(this.lgn_create); this.toolStripContainer1.ContentPanel.Controls.Add(this.job_current); @@ -618,6 +619,7 @@ namespace ShiftOS.WinForms.Applications // // pnlbuy // + this.pnlbuy.Controls.Add(this.btneditshop); this.pnlbuy.Controls.Add(this.lbprice); this.pnlbuy.Controls.Add(this.btnbuy); this.pnlbuy.Dock = System.Windows.Forms.DockStyle.Bottom; @@ -1186,6 +1188,17 @@ namespace ShiftOS.WinForms.Applications this.txtshopdescription.TabIndex = 2; this.txtshopdescription.TextChanged += new System.EventHandler(this.txtshopdescription_TextChanged); // + // btneditshop + // + this.btneditshop.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.btneditshop.Location = new System.Drawing.Point(198, 3); + this.btneditshop.Name = "btneditshop"; + this.btneditshop.Size = new System.Drawing.Size(75, 23); + this.btneditshop.TabIndex = 2; + this.btneditshop.Text = "Edit shop"; + this.btneditshop.UseVisualStyleBackColor = true; + this.btneditshop.Click += new System.EventHandler(this.btneditshop_Click); + // // MUDControlCentre // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -1348,5 +1361,6 @@ namespace ShiftOS.WinForms.Applications private System.Windows.Forms.Button btnaddshopitem; private System.Windows.Forms.Button btnremoveitem; private System.Windows.Forms.Button btnedititem; + private System.Windows.Forms.Button btneditshop; } } diff --git a/ShiftOS.WinForms/Applications/MUDControlCentre.cs b/ShiftOS.WinForms/Applications/MUDControlCentre.cs index e2758ae..5e93e2f 100644 --- a/ShiftOS.WinForms/Applications/MUDControlCentre.cs +++ b/ShiftOS.WinForms/Applications/MUDControlCentre.cs @@ -180,7 +180,13 @@ namespace ShiftOS.WinForms.Applications public void PopulateShopEditor() { - + txtshopdescription.Text = editingShop.Description; + txtshopname.Text = editingShop.Description; + lbeditingshopitems.Items.Clear(); + foreach(var item in editingShop.Items) + { + lbeditingshopitems.Items.Add(item.Name); + } } public void PopulateShopList(Shop[] shops) @@ -265,6 +271,14 @@ namespace ShiftOS.WinForms.Applications lbprice.Text = $"Cost: {item.Cost} CP"; btnbuy.Show(); }; + if(shop.Owner == SaveSystem.CurrentSave.Username) + { + btneditshop.Show(); + } + else + { + btneditshop.Hide(); + } } private ShopItem item = null; @@ -740,5 +754,13 @@ Current legions: {legionname}"; { ServerManager.SendMessage("user_get_shop", SaveSystem.CurrentSave.Username); } + + private void btneditshop_Click(object sender, EventArgs e) + { + editingShop = CurrentShop; + creatingShop = false; + shop_editor.BringToFront(); + PopulateShopEditor(); + } } } diff --git a/ShiftOS.WinForms/Applications/MUDControlCentre.resx b/ShiftOS.WinForms/Applications/MUDControlCentre.resx index 5dafdb5..4c4f474 100644 --- a/ShiftOS.WinForms/Applications/MUDControlCentre.resx +++ b/ShiftOS.WinForms/Applications/MUDControlCentre.resx @@ -123,6 +123,9 @@ 132, 17 + + The multi-user domain has many unique shops selling many items such as applications, skins and other things. Just choose a shop, browse for an item you'd like, then pay Codepoints and the download will begin. + On this screen you can customize your legion profile. This is how users will see your legion inside the Join Legion screen. @@ -130,7 +133,4 @@ You can set up a banner color, short and long name, and a description on this sc The description will be what explains your legion - what does it do? Why should the user join it? Stuff like that. - - The multi-user domain has many unique shops selling many items such as applications, skins and other things. Just choose a shop, browse for an item you'd like, then pay Codepoints and the download will begin. - \ No newline at end of file