コード例 #1
0
        // Start getting a list of matches
        internal Coroutine ListMatches(ListMatchRequest req, DataResponseDelegate <List <MatchInfoSnapshot> > callback)
        {
            if (callback == null)
            {
                Debug.Log("callback supplied is null, aborting ListMatch Request.");
                return(null);
            }

            Uri uri = new Uri(baseUri, "/json/reply/ListMatchRequest");

            Debug.Log("MatchMakingClient ListMatches :" + uri);

            var data = new WWWForm();

            data.AddField("version", UnityEngine.Networking.Match.Request.currentVersion);
            data.AddField("projectId", Application.cloudProjectId);
            data.AddField("sourceId", Utility.GetSourceID().ToString());
            data.AddField("accessTokenString", 0); // Set access token to 0 for list requests
            data.AddField("domain", req.domain);

            data.AddField("pageSize", req.pageSize);
            data.AddField("pageNum", req.pageNum);
            data.AddField("nameFilter", req.nameFilter);
            data.AddField("filterOutPrivateMatches", req.filterOutPrivateMatches.ToString());
            data.AddField("eloScore", req.eloScore.ToString());

            data.headers["Accept"] = "application/json";

            var client = UnityWebRequest.Post(uri.ToString(), data);

            return(StartCoroutine(ProcessMatchResponse <ListMatchResponse, DataResponseDelegate <List <MatchInfoSnapshot> > >(client, OnMatchList, callback)));
        }
コード例 #2
0
        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);
        }
コード例 #3
0
ファイル: NetworkMatch.cs プロジェクト: randomize/VimConfig
        public Coroutine ListMatches(int startPageNumber, int resultPageSize, string matchNameFilter, ResponseDelegate <ListMatchResponse> callback)
        {
            ListMatchRequest req = new ListMatchRequest {
                pageNum    = startPageNumber,
                pageSize   = resultPageSize,
                nameFilter = matchNameFilter
            };

            return(this.ListMatches(req, callback));
        }
コード例 #4
0
        public Coroutine ListMatches(int startPageNumber, int resultPageSize, string matchNameFilter, bool filterOutPrivateMatchesFromResults, int eloScoreTarget, int requestDomain, DataResponseDelegate <List <MatchInfoSnapshot> > callback)
        {
            ListMatchRequest req = new ListMatchRequest {
                pageNum    = startPageNumber,
                pageSize   = resultPageSize,
                nameFilter = matchNameFilter,
                filterOutPrivateMatches = filterOutPrivateMatchesFromResults,
                eloScore = eloScoreTarget,
                domain   = requestDomain
            };

            return(this.ListMatches(req, callback));
        }
コード例 #5
0
        public Coroutine ListMatches(int startPageNumber, int resultPageSize, string matchNameFilter, bool filterOutPrivateMatchesFromResults, int eloScoreTarget, int requestDomain, DataResponseDelegate <List <MatchInfoSnapshot> > callback)
        {
            if (Application.platform == RuntimePlatform.WebGLPlayer)
            {
                UnityEngine.Debug.LogError("Matchmaking is not supported on WebGL player.");
                return(null);
            }
            ListMatchRequest req = new ListMatchRequest {
                pageNum    = startPageNumber,
                pageSize   = resultPageSize,
                nameFilter = matchNameFilter,
                filterOutPrivateMatches = filterOutPrivateMatchesFromResults,
                eloScore = eloScoreTarget,
                domain   = requestDomain
            };

            return(this.ListMatches(req, callback));
        }
コード例 #6
0
ファイル: EloMatchMaker.cs プロジェクト: projectelo/game
    public void ListAndJoinMatch()
    {
        if(!NetworkManager.singleton.matchMaker)
        {
            StartMatchMaker();
        }

        ListMatchRequest request = new ListMatchRequest();
        request.domain = 1;
        request.includePasswordMatches = false;
        request.appId = EloConfig.PROGRAM_APP_ID;
        request.pageNum = 0;
        request.pageSize = 20;
        request.projectId = EloConfig.CLOUD_PROJECT_ID;
        request.nameFilter = "GameRoom";

        NetworkManager.singleton.matchMaker.ListMatches(request, OnMatchList);
    }
コード例 #7
0
        public Coroutine ListMatches(ListMatchRequest req, NetworkMatch.ResponseDelegate <ListMatchResponse> callback)
        {
            Uri uri = new Uri(this.baseUri, "/json/reply/ListMatchRequest");

            UnityEngine.Debug.Log((object)("MatchMakingClient ListMatches :" + (object)uri));
            WWWForm form = new WWWForm();

            form.AddField("projectId", Application.cloudProjectId);
            form.AddField("sourceId", Utility.GetSourceID().ToString());
            form.AddField("appId", Utility.GetAppID().ToString());
            form.AddField("includePasswordMatches", req.includePasswordMatches.ToString());
            form.AddField("accessTokenString", 0);
            form.AddField("domain", 0);
            form.AddField("pageSize", req.pageSize);
            form.AddField("pageNum", req.pageNum);
            form.AddField("nameFilter", req.nameFilter);
            form.headers["Accept"] = "application/json";
            return(this.StartCoroutine(this.ProcessMatchResponse <ListMatchResponse>(new WWW(uri.ToString(), form), callback)));
        }
コード例 #8
0
        public Coroutine ListMatches(ListMatchRequest req, ResponseDelegate <ListMatchResponse> callback)
        {
            Uri uri = new Uri(baseUri, "/json/reply/ListMatchRequest");

            Debug.Log("MatchMakingClient ListMatches :" + uri);
            WWWForm wWWForm = new WWWForm();

            wWWForm.AddField("projectId", Application.cloudProjectId);
            wWWForm.AddField("sourceId", Utility.GetSourceID().ToString());
            wWWForm.AddField("appId", Utility.GetAppID().ToString());
            wWWForm.AddField("includePasswordMatches", req.includePasswordMatches.ToString());
            wWWForm.AddField("accessTokenString", 0);
            wWWForm.AddField("domain", 0);
            wWWForm.AddField("pageSize", req.pageSize);
            wWWForm.AddField("pageNum", req.pageNum);
            wWWForm.AddField("nameFilter", req.nameFilter);
            wWWForm.headers["Accept"] = "application/json";
            WWW client = new WWW(uri.ToString(), wWWForm);

            return(StartCoroutine(ProcessMatchResponse(client, callback)));
        }
コード例 #9
0
ファイル: TitleScreen.cs プロジェクト: blufiro/CiderFox
	public void OnClickFindGame() {
		Debug.Log ("OnClickFindGame()");
		var req = new ListMatchRequest ();
		req.pageNum = 0;
		req.pageSize = 20;
		req.nameFilter = onlineFindFilterGameNameInput.text;
		req.includePasswordMatches = false;
		match.ListMatches(req, OnMatchList);
		// clear content
		for (int i = 0; i < onlineFindScrollRect.content.childCount; i++) {
			Transform t = onlineFindScrollRect.content.GetChild (i);
			t = null;
			Destroy (t);
		}
		onlineFindGameButton.gameObject.SetActive (false);
	}
コード例 #10
0
ファイル: Test.cs プロジェクト: Ragzouken/smooltool
    private IEnumerator RefreshList()
    {
        testLAN.Initialize();
        //testLAN.StopBroadcast();
        testLAN.StartAsClient();
        bool test = false;
        testLAN.OnReceive += (ip, data) =>
        {
            var listing = new GameListing
            {
                address = ip,
            };

            lanGames[ip] = listing;

            ParseName(data,
                      out listing.name,
                      out listing.version,
                      out listing.count);

            listing.name = "(LOCAL) " + listing.name;
        };

        while (hostID == -1)
        {
            testLAN.broadcastData = hostedname + "!" + (int)version + "?" + clients.Count;

            var request = new ListMatchRequest();
            request.nameFilter = "";
            request.pageSize = 32;

            match.ListMatches(request, matches =>
            {
                matchGames.Clear();

                if (!matches.success)
                {
                    newerVersionDisableObject.SetActive(false);
                    noWorldsDisableObject.SetActive(false);
                    cantConnectDisableObject.SetActive(true);

                    RefreshListing();

                    return;
                }

                var list = matches.matches;

                var valid = list.Where(m => GetVersion(m) == (int)version);
                var newer = list.Where(m => GetVersion(m) >  (int)version);

                newerVersionDisableObject.SetActive(newer.Any());
                noWorldsDisableObject.SetActive(!newer.Any() && !valid.Any());
                cantConnectDisableObject.SetActive(false);
                worlds.SetActive(valid.Select(m => ConvertListing(m)));

                matchGames.Clear();
                matchGames.AddRange(valid.Select(m => ConvertListing(m)));

                if (selected != null
                 && selected.match != null
                 && !list.Any(m => m.networkId == selected.match.networkId))
                {
                    DeselectMatch();
                }

                RefreshListing();
            });

            yield return new WaitForSeconds(5);
        }
    }