fix bug with multiplayer ui

This commit is contained in:
Michael 2017-05-04 16:06:32 -04:00
parent e43d47007e
commit 41da0b2500
2 changed files with 19 additions and 0 deletions

View file

@ -193,6 +193,7 @@ namespace ShiftOS.WinForms.Applications
this.pnlmultiplayerhandshake.Name = "pnlmultiplayerhandshake";
this.pnlmultiplayerhandshake.Size = new System.Drawing.Size(396, 231);
this.pnlmultiplayerhandshake.TabIndex = 15;
this.pnlmultiplayerhandshake.Visible = false;
//
// lvotherplayers
//

View file

@ -374,6 +374,14 @@ namespace ShiftOS.WinForms.Applications
LeaderX = pt.X;
LeaderY = pt.Y;
}
else if(msg.Name == "pong_mp_left")
{
this.Invoke(new Action(() =>
{
AppearanceManager.Close(this);
}));
Infobox.Show("Opponent has closed Pong.", "The opponent has closed Pong, therefore the connection between you two has dropped.");
}
else if (msg.Name == "pong_mp_youlose")
{
LoseMP();
@ -408,6 +416,7 @@ namespace ShiftOS.WinForms.Applications
else if (msg.Name == "pong_handshake_chosen")
{
IsLeader = false;
LeaveMatchmake();
OpponentGUID = msg.Contents;
YouGUID = ServerManager.thisGuid.ToString();
SendFollowerGUID();
@ -984,6 +993,7 @@ namespace ShiftOS.WinForms.Applications
pnlfinalstats.Hide();
CenterPanels();
lblbeatai.Hide();
ServerManager.MessageReceived += this.ServerMessageReceivedHandler;
}
public void OnSkinLoad()
@ -997,6 +1007,14 @@ namespace ShiftOS.WinForms.Applications
public bool OnUnload()
{
if(IsMultiplayerSession == true)
{
if(!string.IsNullOrWhiteSpace(OpponentGUID))
ServerManager.Forward(OpponentGUID, "pong_mp_left", null);
}
LeaveMatchmake();
ServerManager.MessageReceived -= this.ServerMessageReceivedHandler;
return true;
}