"My Shop" menu item works.
This commit is contained in:
parent
d8eb2d79e0
commit
beb2bb27d7
3 changed files with 44 additions and 1 deletions
|
@ -687,7 +687,30 @@ Contents:
|
|||
}));
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case "user_get_shop":
|
||||
string shopOwner = msg.Contents;
|
||||
if (File.Exists("shops.json"))
|
||||
foreach (var shop in JsonConvert.DeserializeObject<List<Shop>>(File.ReadAllText("shops.json")))
|
||||
{
|
||||
if (shop.Owner == shopOwner)
|
||||
{
|
||||
server.DispatchTo(new Guid(msg.GUID), new NetObject("ruecuodaL", new ServerMessage
|
||||
{
|
||||
Name = "user_shop",
|
||||
GUID = "server",
|
||||
Contents = JsonConvert.SerializeObject(shop)
|
||||
}));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
server.DispatchTo(new Guid(msg.GUID), new NetObject("ruecuodaL", new ServerMessage
|
||||
{
|
||||
Name = "user_noshop",
|
||||
GUID = "server",
|
||||
}));
|
||||
|
||||
break;
|
||||
case "pong_gethighscores":
|
||||
if (File.Exists("pong_highscores.json"))
|
||||
{
|
||||
|
|
|
@ -244,6 +244,7 @@ namespace ShiftOS.WinForms.Applications
|
|||
this.myShopToolStripMenuItem.Name = "myShopToolStripMenuItem";
|
||||
this.myShopToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.myShopToolStripMenuItem.Text = "My Shop";
|
||||
this.myShopToolStripMenuItem.Click += new System.EventHandler(this.myShopToolStripMenuItem_Click);
|
||||
//
|
||||
// openAShopToolStripMenuItem
|
||||
//
|
||||
|
|
|
@ -133,6 +133,20 @@ namespace ShiftOS.WinForms.Applications
|
|||
{
|
||||
PopulateJoinLegion(JsonConvert.DeserializeObject<List<Legion>>(msg.Contents));
|
||||
}
|
||||
else if(msg.Name == "user_shop")
|
||||
{
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
ShowShop(JsonConvert.DeserializeObject<Shop>(msg.Contents));
|
||||
}));
|
||||
}
|
||||
else if(msg.Name == "user_noshop")
|
||||
{
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
Infobox.Show("No shop.", "You do not currently own any shops. You must open one to use this screen.");
|
||||
}));
|
||||
}
|
||||
else if (msg.Name == "shop_allshops")
|
||||
{
|
||||
this.Invoke(new Action(() =>
|
||||
|
@ -720,5 +734,10 @@ Current legions: {legionname}";
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
private void myShopToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
ServerManager.SendMessage("user_get_shop", SaveSystem.CurrentSave.Username);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue