public void OnRMPunchedClient(NetworkMessage msg) { Debug.Log("YO FAM PUNCHMSG RECEIVED ON CLIENT"); PunchMsg parsed = msg.ReadMessage <PunchMsg> (); //natHelper.rakPeer.Shutdown (0); OnHolePunchedGameClient(parsed.natListenPort, parsed.natConnectPort); }
public void OnRMPunchedRelay(NetworkMessage msg) { PunchMsg parsed = msg.ReadMessage <PunchMsg> (); if (waitJoin.ContainsKey(parsed.clientGUID)) { Debug.Log("RM PUNCHED NOW RELAYING PUNCHMSG TO CLIENT RIGHT AWAY"); waitJoin [parsed.clientGUID].Send(NetMsg.RMPunched, parsed); } else { Debug.Log("RM PUNCHED BUT GUID NOT REGISTERED, WAITING"); StartCoroutine(WaitForJoinRequest(parsed)); } }
IEnumerator WaitForJoinRequest(PunchMsg msg) { for (int a = 0; a < 600; a++) { if (waitJoin.ContainsKey(msg.clientGUID)) { Debug.Log("WAITED, RELAYING PUNCHMSG TO CLIENT"); waitJoin [msg.clientGUID].Send(NetMsg.RMPunched, msg); break; } else { yield return(new WaitForSecondsRealtime(0.1f)); } } }