aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.WinForms
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-05-04 16:06:32 -0400
committerMichael <[email protected]>2017-05-04 16:06:32 -0400
commit41da0b25000f93cf405d6bf18a1597e2616731bd (patch)
tree4cee90bda464f3aeb047652db54d8f1e708a4709 /ShiftOS.WinForms
parente43d47007e8ef5d18a0b58b9c1c24ca6e5212e18 (diff)
downloadshiftos_thereturn-41da0b25000f93cf405d6bf18a1597e2616731bd.tar.gz
shiftos_thereturn-41da0b25000f93cf405d6bf18a1597e2616731bd.tar.bz2
shiftos_thereturn-41da0b25000f93cf405d6bf18a1597e2616731bd.zip
fix bug with multiplayer ui
Diffstat (limited to 'ShiftOS.WinForms')
-rw-r--r--ShiftOS.WinForms/Applications/Pong.Designer.cs1
-rw-r--r--ShiftOS.WinForms/Applications/Pong.cs18
2 files changed, 19 insertions, 0 deletions
diff --git a/ShiftOS.WinForms/Applications/Pong.Designer.cs b/ShiftOS.WinForms/Applications/Pong.Designer.cs
index d0ff466..0254e94 100644
--- a/ShiftOS.WinForms/Applications/Pong.Designer.cs
+++ b/ShiftOS.WinForms/Applications/Pong.Designer.cs
@@ -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
//
diff --git a/ShiftOS.WinForms/Applications/Pong.cs b/ShiftOS.WinForms/Applications/Pong.cs
index ad81197..3e93c34 100644
--- a/ShiftOS.WinForms/Applications/Pong.cs
+++ b/ShiftOS.WinForms/Applications/Pong.cs
@@ -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;
}