コード例 #1
0
        // Set attributes for matches in progress
        internal Coroutine SetMatchAttributes(SetMatchAttributesRequest req, BasicResponseDelegate callback)
        {
            if (callback == null)
            {
                Debug.Log("callback supplied is null, aborting SetMatchAttributes Request.");
                return(null);
            }

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

            Debug.Log("MatchMakingClient SetMatchAttributes :" + 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", Utility.GetAccessTokenForNetwork(req.networkId).GetByteString());
            data.AddField("domain", req.domain);

            data.AddField("networkId", req.networkId.ToString());
            data.AddField("isListed", req.isListed.ToString());

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

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

            return(StartCoroutine(ProcessMatchResponse <BasicResponse, BasicResponseDelegate>(client, OnSetMatchAttributes, callback)));
        }
コード例 #2
0
 public Coroutine DestroyMatch(NetworkID netId, int requestDomain, BasicResponseDelegate callback)
 {
     return(DestroyMatch(new DestroyMatchRequest
     {
         networkId = netId,
         domain = requestDomain
     }, callback));
 }
コード例 #3
0
        internal Coroutine DestroyMatch(DestroyMatchRequest req, BasicResponseDelegate callback)
        {
            if (callback == null)
            {
                Debug.Log("callback supplied is null, aborting DestroyMatch Request.");
                return(null);
            }
            Uri uri = new Uri(baseUri, "/json/reply/DestroyMatchRequest");

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

            wWWForm.AddField("version", Request.currentVersion);
            wWWForm.AddField("projectId", Application.cloudProjectId);
            wWWForm.AddField("sourceId", Utility.GetSourceID().ToString());
            wWWForm.AddField("accessTokenString", Utility.GetAccessTokenForNetwork(req.networkId).GetByteString());
            wWWForm.AddField("domain", req.domain);
            wWWForm.AddField("networkId", req.networkId.ToString());
            wWWForm.headers["Accept"] = "application/json";
            WWW client = new WWW(uri.ToString(), wWWForm);

            return(StartCoroutine(ProcessMatchResponse <BasicResponse, BasicResponseDelegate>(client, OnMatchDestroyed, callback)));
        }
コード例 #4
0
        internal Coroutine SetMatchAttributes(SetMatchAttributesRequest req, BasicResponseDelegate callback)
        {
            if (callback == null)
            {
                UnityEngine.Debug.Log("callback supplied is null, aborting SetMatchAttributes Request.");
                return(null);
            }
            Uri uri = new Uri(this.baseUri, "/json/reply/SetMatchAttributesRequest");

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

            form.AddField("version", Request.currentVersion);
            form.AddField("projectId", Application.cloudProjectId);
            form.AddField("sourceId", Utility.GetSourceID().ToString());
            form.AddField("accessTokenString", Utility.GetAccessTokenForNetwork(req.networkId).GetByteString());
            form.AddField("domain", req.domain);
            form.AddField("networkId", req.networkId.ToString());
            form.AddField("isListed", req.isListed.ToString());
            form.headers["Accept"] = "application/json";
            WWW client = new WWW(uri.ToString(), form);

            return(base.StartCoroutine(this.ProcessMatchResponse <BasicResponse, BasicResponseDelegate>(client, new InternalResponseDelegate <BasicResponse, BasicResponseDelegate>(this.OnSetMatchAttributes), callback)));
        }
コード例 #5
0
 internal void OnSetMatchAttributes(BasicResponse response, BasicResponseDelegate userCallback)
 {
     userCallback(response.success, response.extendedInfo);
 }
コード例 #6
0
 public Coroutine SetMatchAttributes(NetworkID networkId, bool isListed, int requestDomain, BasicResponseDelegate callback)
 {
     return(SetMatchAttributes(new SetMatchAttributesRequest {
         networkId = networkId, isListed = isListed, domain = requestDomain
     }, callback));
 }
コード例 #7
0
 internal void OnDropConnection(DropConnectionResponse response, BasicResponseDelegate userCallback)
 {
     userCallback(response.success, response.extendedInfo);
 }
コード例 #8
0
 public Coroutine DropConnection(NetworkID netId, NodeID dropNodeId, int requestDomain, BasicResponseDelegate callback)
 {
     return(DropConnection(new DropConnectionRequest {
         networkId = netId, nodeId = dropNodeId, domain = requestDomain
     }, callback));
 }
コード例 #9
0
 internal void OnMatchDestroyed(BasicResponse response, BasicResponseDelegate userCallback)
 {
     userCallback(response.success, response.extendedInfo);
 }