Пример #1
0
        public void AcceptMatchAndSetup(IEnumerable <NetworkStream <MatchmakeResultData> .DataWrapper> dataWrappers)
        {
            foreach (var data in dataWrappers)
            {
                if (data.IsNotExpired && !isInMatch)
                {
                    _auth = data.Data.Auth;

                    Client.Instance.match = Client.Instance.tcp;
                    AcceptFoundMatch(Client.Instance.match);

                    data.MarkForRemoval();
                }
            }

            /*Client.Instance.EnterMatch(matchmakeResult.MatchServerAddress, matchmakeResult.MatchServerPort);
             * Subscribe(Client.Instance.match); todo */

            void AcceptFoundMatch(Client.TCP tcp)
            {
                var acceptMatch = new AcceptMatch();

                acceptMatch.Auth = Auth;
                ClientSend.AcceptMatch(ref acceptMatch);

                Debug.Log($"Accepting Match.");
            }

            void ErrorConnectingToMatchServer(Client.TCP tcp)
            {
                Debug.Log(
                    $"Did find match, but encountered error in connecting to Match Server: {tcp.socket.Client.RemoteEndPoint}");
            }
        }
Пример #2
0
 public static void AcceptMatch(ref AcceptMatch accept)
 {
     Assert.IsNotNull(Client.Instance.match);
     SendStruct(ref accept, ClientPackets.acceptMatch, Client.Instance.match);
 }