Exemple #1
0
        public Coroutine DestroyMatch(DestroyMatchRequest req, NetworkMatch.ResponseDelegate <BasicResponse> callback)
        {
            Uri uri = new Uri(this.baseUri, "/json/reply/DestroyMatchRequest");

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

            form.AddField("projectId", Application.cloudProjectId);
            form.AddField("sourceId", Utility.GetSourceID().ToString());
            form.AddField("appId", Utility.GetAppID().ToString());
            form.AddField("accessTokenString", Utility.GetAccessTokenForNetwork(req.networkId).GetByteString());
            form.AddField("domain", 0);
            form.AddField("networkId", req.networkId.ToString());
            form.headers["Accept"] = "application/json";
            return(this.StartCoroutine(this.ProcessMatchResponse <BasicResponse>(new WWW(uri.ToString(), form), callback)));
        }
Exemple #2
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)));
        }
Exemple #3
0
 public override void OnLobbyClientEnter( )
 {
     _RoomSceneInit();
     Button.ButtonClickedEvent onclick = GameObject.FindGameObjectWithTag("exit room").GetComponent<Button>().onClick;
     switch (m_netStt)
     {
         case ConstantDefine.NetworkState.Host:
             onclick.AddListener(delegate
             {
                 DestroyMatchRequest request = new DestroyMatchRequest();
                 request.accessTokenString = matchInfo.accessToken.GetByteString();
                 request.appId = Utility.GetAppID();
                 request.networkId = matchInfo.networkId;
                 matchMaker.DestroyMatch(matchInfo.networkId, _OnDestroyMatch);
             });
             break;
         case ConstantDefine.NetworkState.Client:
             onclick.AddListener(delegate
             {
                 client.Send(MessageDefine.ClientLeaveRoomMsgId, new MessageDefine.ClientLeaveRoomMessage(m_playerName, matchInfo.nodeId));
                 //StartCoroutine(_Waiting("EXITING"));
             });
             break;
     }
 }