public virtual void JoinInternetLobby(
            NetworkID networkId,
            string matchPassword,
            string publicClientAddress,
            string privateClientAddress,
            int eloScoreForClient,
            int requestDomain,
            NetworkMatch.DataResponseDelegate <MatchInfo> callback = null
            )
        {
            //Check callback:
            if (callback == null)
            {
                callback = NetworkManager.singleton.OnMatchJoined;
            }

            //Join match:
            var matchMaker = NetworkManager.singleton.matchMaker;

            matchMaker.JoinMatch(
                networkId,
                matchPassword,
                publicClientAddress,
                privateClientAddress,
                eloScoreForClient,
                requestDomain,
                callback
                );
        }
Beispiel #2
0
 public void Setup(MatchInfoSnapshot _match, standardAnnouncement _onMatchClicked, NetworkMatch.DataResponseDelegate <MatchInfo> _onMatchJoined)
 {
     match              = _match;
     onMatchClicked     = _onMatchClicked;
     onMatchJoined      = _onMatchJoined;
     matchNameText.text = match.name;
 }
Beispiel #3
0
        /**
         * Create internet match.
         */

        public virtual void CreateInternetLobby(
            string lobbyName,
            uint roomSize,
            string publicClientAddress,
            string privateClientAddress,
            int eloScoreForMatch,
            int requestDomain,
            bool matchAdvertise,
            string matchPassword,
            NetworkMatch.DataResponseDelegate <MatchInfo> callback = null
            )
        {
            //Check callback:
            if (callback == null)
            {
                callback = NetworkManager.singleton.OnMatchCreate;
            }

            //Create match:
            var matchMaker = NetworkManager.singleton.matchMaker;

            matchMaker.CreateMatch(
                lobbyName,
                roomSize,
                matchAdvertise,
                matchPassword,
                publicClientAddress,
                privateClientAddress,
                eloScoreForMatch,
                requestDomain,
                callback
                );
        }
        internal Coroutine ListMatches(ListMatchRequest req, NetworkMatch.DataResponseDelegate <List <MatchInfoSnapshot> > callback)
        {
            Coroutine result;

            if (callback == null)
            {
                UnityEngine.Debug.Log("callback supplied is null, aborting ListMatch Request.");
                result = null;
            }
            else
            {
                Uri uri = new Uri(this.baseUri, "/json/reply/ListMatchRequest");
                UnityEngine.Debug.Log("MatchMakingClient ListMatches :" + uri);
                WWWForm wWWForm = new WWWForm();
                wWWForm.AddField("version", Request.currentVersion);
                wWWForm.AddField("projectId", Application.cloudProjectId);
                wWWForm.AddField("sourceId", Utility.GetSourceID().ToString());
                wWWForm.AddField("accessTokenString", 0);
                wWWForm.AddField("domain", req.domain);
                wWWForm.AddField("pageSize", req.pageSize);
                wWWForm.AddField("pageNum", req.pageNum);
                wWWForm.AddField("nameFilter", req.nameFilter);
                wWWForm.AddField("filterOutPrivateMatches", req.filterOutPrivateMatches.ToString());
                wWWForm.AddField("eloScore", req.eloScore.ToString());
                wWWForm.headers["Accept"] = "application/json";
                WWW client = new WWW(uri.ToString(), wWWForm);
                result = base.StartCoroutine(this.ProcessMatchResponse <ListMatchResponse, NetworkMatch.DataResponseDelegate <List <MatchInfoSnapshot> > >(client, new NetworkMatch.InternalResponseDelegate <ListMatchResponse, NetworkMatch.DataResponseDelegate <List <MatchInfoSnapshot> > >(this.OnMatchList), callback));
            }
            return(result);
        }
        internal Coroutine CreateMatch(CreateMatchRequest req, NetworkMatch.DataResponseDelegate <MatchInfo> callback)
        {
            Coroutine result;

            if (callback == null)
            {
                UnityEngine.Debug.Log("callback supplied is null, aborting CreateMatch Request.");
                result = null;
            }
            else
            {
                Uri uri = new Uri(this.baseUri, "/json/reply/CreateMatchRequest");
                UnityEngine.Debug.Log("MatchMakingClient Create :" + uri);
                WWWForm wWWForm = new WWWForm();
                wWWForm.AddField("version", Request.currentVersion);
                wWWForm.AddField("projectId", Application.cloudProjectId);
                wWWForm.AddField("sourceId", Utility.GetSourceID().ToString());
                wWWForm.AddField("accessTokenString", 0);
                wWWForm.AddField("domain", req.domain);
                wWWForm.AddField("name", req.name);
                wWWForm.AddField("size", req.size.ToString());
                wWWForm.AddField("advertise", req.advertise.ToString());
                wWWForm.AddField("password", req.password);
                wWWForm.AddField("publicAddress", req.publicAddress);
                wWWForm.AddField("privateAddress", req.privateAddress);
                wWWForm.AddField("eloScore", req.eloScore.ToString());
                wWWForm.headers["Accept"] = "application/json";
                WWW client = new WWW(uri.ToString(), wWWForm);
                result = base.StartCoroutine(this.ProcessMatchResponse <CreateMatchResponse, NetworkMatch.DataResponseDelegate <MatchInfo> >(client, new NetworkMatch.InternalResponseDelegate <CreateMatchResponse, NetworkMatch.DataResponseDelegate <MatchInfo> >(this.OnMatchCreate), callback));
            }
            return(result);
        }
        public virtual void FindInternetLobbies(int startPageNumber,
                                                int resultPageSize,
                                                string matchNameFilter,
                                                bool filterOutPrivateMatchesFromResults,
                                                int eloScoreTarget,
                                                int requestDomain,
                                                NetworkMatch.DataResponseDelegate <List <MatchInfoSnapshot> > callback = null
                                                )
        {
            //Check callback:
            if (callback == null)
            {
                callback = NetworkManager.singleton.OnMatchList;
            }

            //Find matches:
            var matchMaker = NetworkManager.singleton.matchMaker;

            matchMaker.ListMatches(
                startPageNumber,
                resultPageSize,
                matchNameFilter,
                filterOutPrivateMatchesFromResults,
                eloScoreTarget,
                requestDomain,
                callback
                );
        }
Beispiel #7
0
        internal Coroutine JoinMatch(JoinMatchRequest req, NetworkMatch.DataResponseDelegate <MatchInfo> callback)
        {
            bool      flag = callback == null;
            Coroutine result;

            if (flag)
            {
                Debug.Log("callback supplied is null, aborting JoinMatch Request.");
                result = null;
            }
            else
            {
                Uri    uri      = new Uri(this.baseUri, "/json/reply/JoinMatchRequest");
                string arg_40_0 = "MatchMakingClient Join :";
                Uri    expr_34  = uri;
                Debug.Log(arg_40_0 + ((expr_34 != null) ? expr_34.ToString() : null));
                WWWForm wWWForm = new WWWForm();
                wWWForm.AddField("version", Request.currentVersion);
                wWWForm.AddField("projectId", Application.cloudProjectId);
                wWWForm.AddField("sourceId", Utility.GetSourceID().ToString());
                wWWForm.AddField("accessTokenString", 0);
                wWWForm.AddField("domain", req.domain);
                wWWForm.AddField("networkId", req.networkId.ToString());
                wWWForm.AddField("password", req.password);
                wWWForm.AddField("publicAddress", req.publicAddress);
                wWWForm.AddField("privateAddress", req.privateAddress);
                wWWForm.AddField("eloScore", req.eloScore.ToString());
                wWWForm.headers["Accept"] = "application/json";
                UnityWebRequest client = UnityWebRequest.Post(uri.ToString(), wWWForm);
                result = base.StartCoroutine(this.ProcessMatchResponse <JoinMatchResponse, NetworkMatch.DataResponseDelegate <MatchInfo> >(client, new NetworkMatch.InternalResponseDelegate <JoinMatchResponse, NetworkMatch.DataResponseDelegate <MatchInfo> >(this.OnMatchJoined), callback));
            }
            return(result);
        }
 internal virtual void OnMatchCreate(CreateMatchResponse response, NetworkMatch.DataResponseDelegate <MatchInfo> userCallback)
 {
     if (response.success)
     {
         Utility.SetAccessTokenForNetwork(response.networkId, new NetworkAccessToken(response.accessTokenString));
     }
     userCallback(response.success, response.extendedInfo, new MatchInfo(response));
 }
Beispiel #9
0
        internal void OnMatchJoined(JoinMatchResponse response, NetworkMatch.DataResponseDelegate <MatchInfo> userCallback)
        {
            bool success = response.success;

            if (success)
            {
                Utility.SetAccessTokenForNetwork((NetworkID)response.networkId, new NetworkAccessToken(response.accessTokenString));
            }
            userCallback(response.success, response.extendedInfo, new MatchInfo(response));
        }
        internal void OnMatchList(ListMatchResponse response, NetworkMatch.DataResponseDelegate <List <MatchInfoSnapshot> > userCallback)
        {
            List <MatchInfoSnapshot> list = new List <MatchInfoSnapshot>();

            foreach (MatchDesc current in response.matches)
            {
                list.Add(new MatchInfoSnapshot(current));
            }
            userCallback(response.success, response.extendedInfo, list);
        }
Beispiel #11
0
        public void StartMatch(NetworkMatch.DataResponseDelegate <MatchInfo> onMatchCreateCallback,
                               NetworkMatch.DataResponseDelegate <List <MatchInfoSnapshot> > onMatchListCallback)
        {
            StartMatchMaker();

            if (IsHost)
            {
                matchMaker.CreateMatch(string.Format("game_{0}", Random.Range(0, 100)), 2, true, "", "", "", 0, 0, onMatchCreateCallback);
            }
            else
            {
                matchMaker.ListMatches(0, 10, "", true, 0, 0, onMatchListCallback);
            }
        }
 public void JoinInternetMatch(NetworkID netID, string password, string publicClientAddr,
                               string privateClientAddr, int eloScore, int reqDomain, NetworkMatch.DataResponseDelegate <MatchInfo> callback)
 {
     NetworkManager.singleton.matchMaker.JoinMatch(netID, password, publicClientAddr, privateClientAddr,
                                                   eloScore, reqDomain, OnJoinInternetMatch);
 }
 public Coroutine JoinMatch(NetworkID netId, string matchPassword, string publicClientAddress, string privateClientAddress, int eloScoreForClient, int requestDomain, NetworkMatch.DataResponseDelegate <MatchInfo> callback)
 {
     return(this.JoinMatch(new JoinMatchRequest
     {
         networkId = netId,
         password = matchPassword,
         publicAddress = publicClientAddress,
         privateAddress = privateClientAddress,
         eloScore = eloScoreForClient,
         domain = requestDomain
     }, callback));
 }
Beispiel #14
0
 public void JoinMatch(NetworkID networkId, NetworkMatch.DataResponseDelegate <MatchInfo> onJoinedMatchCallback)
 {
     matchMaker.JoinMatch(networkId, "", "", "", 0, 0, onJoinedMatchCallback);
 }
Beispiel #15
0
 public static void Prefix(NetworkID netId, ref string matchPassword, string publicClientAddress, string privateClientAddress, int eloScoreForClient, int requestDomain, NetworkMatch.DataResponseDelegate <MatchInfo> callback)
 {
     matchPassword += Modloader.Instance.GenerateMultiplayerPassword();
 }
 public Coroutine CreateMatch(string matchName, uint matchSize, bool matchAdvertise, string matchPassword, string publicClientAddress, string privateClientAddress, int eloScoreForMatch, int requestDomain, NetworkMatch.DataResponseDelegate <MatchInfo> callback)
 {
     return(this.CreateMatch(new CreateMatchRequest
     {
         name = matchName,
         size = matchSize,
         advertise = matchAdvertise,
         password = matchPassword,
         publicAddress = publicClientAddress,
         privateAddress = privateClientAddress,
         eloScore = eloScoreForMatch,
         domain = requestDomain
     }, callback));
 }
Beispiel #17
0
        public Coroutine ListMatches(int startPageNumber, int resultPageSize, string matchNameFilter, bool filterOutPrivateMatchesFromResults, int eloScoreTarget, int requestDomain, NetworkMatch.DataResponseDelegate <List <MatchInfoSnapshot> > callback)
        {
            Coroutine result;

            if (Application.platform == RuntimePlatform.WebGLPlayer)
            {
                Debug.LogError("Matchmaking is not supported on WebGL player.");
                result = null;
            }
            else
            {
                result = this.ListMatches(new ListMatchRequest
                {
                    pageNum    = startPageNumber,
                    pageSize   = resultPageSize,
                    nameFilter = matchNameFilter,
                    filterOutPrivateMatches = filterOutPrivateMatchesFromResults,
                    eloScore = eloScoreTarget,
                    domain   = requestDomain
                }, callback);
            }
            return(result);
        }
 public Coroutine ListMatches(int startPageNumber, int resultPageSize, string matchNameFilter, bool filterOutPrivateMatchesFromResults, int eloScoreTarget, int requestDomain, NetworkMatch.DataResponseDelegate <List <MatchInfoSnapshot> > callback)
 {
     return(this.ListMatches(new ListMatchRequest
     {
         pageNum = startPageNumber,
         pageSize = resultPageSize,
         nameFilter = matchNameFilter,
         filterOutPrivateMatches = filterOutPrivateMatchesFromResults,
         eloScore = eloScoreTarget,
         domain = requestDomain
     }, callback));
 }
Beispiel #19
0
        public Coroutine CreateMatch(string matchName, uint matchSize, bool matchAdvertise, string matchPassword, string publicClientAddress, string privateClientAddress, int eloScoreForMatch, int requestDomain, NetworkMatch.DataResponseDelegate <MatchInfo> callback)
        {
            Coroutine result;

            if (Application.platform == RuntimePlatform.WebGLPlayer)
            {
                Debug.LogError("Matchmaking is not supported on WebGL player.");
                result = null;
            }
            else
            {
                result = this.CreateMatch(new CreateMatchRequest
                {
                    name           = matchName,
                    size           = matchSize,
                    advertise      = matchAdvertise,
                    password       = matchPassword,
                    publicAddress  = publicClientAddress,
                    privateAddress = privateClientAddress,
                    eloScore       = eloScoreForMatch,
                    domain         = requestDomain
                }, callback);
            }
            return(result);
        }
 public void JoinInternetMatch(NetworkID netID, string password, string PubClientAddress, string privClientAddress, int eloScore, int reqDomain, NetworkMatch.DataResponseDelegate <MatchInfo> callback)
 {
     Debug.Log("dicks");
     NetworkManager.singleton.matchMaker.JoinMatch(netID, password, PubClientAddress, privClientAddress, eloScore, reqDomain, OnJoinInternetMatch);
 }
 public static void Prefix(string matchName, uint matchSize, bool matchAdvertise, ref string matchPassword, string publicClientAddress, string privateClientAddress, int eloScoreForMatch, int requestDomain, NetworkMatch.DataResponseDelegate <MatchInfo> callback)
 {
     matchPassword += Modloader.Instance.GenerateMultiplayerPassword();
 }