示例#1
0
    public void joinGame(GameObject text)
    {
        string roomName = text.GetComponent <InputField>().text;

        if (roomName != null && roomName.Length > 0)
        {
            Debug.Log("Joining room named " + roomName);
            //find the info for the given room
            MatchDesc j = null;
            foreach (MatchDesc d in matches)
            {
                if (roomName.Equals(d.name))
                {
                    j = d;
                    break;
                }
            }
            if (j == null)
            {
                Debug.LogError("Match not found: " + roomName);
                return;
            }
            JoinMatchRequest matchReq = new JoinMatchRequest();
            matchReq.networkId = j.networkId;
            matchReq.password  = "";
            matchMaker.JoinMatch(matchReq, joinGameCallback);
        }
    }
示例#2
0
        public Response <bool> JoinMatch([FromBody] JoinMatchRequest request)
        {
            _logger.LogInfo("request for join match arrived");
            var identity = HttpContext.User.Identity as ClaimsIdentity;

            if (identity != null)
            {
                request.UserId = identity.FindFirst("jti").Value;
            }
            var result = _matchManager.JoinMatch(request);

            return(result);
        }
示例#3
0
 /// <summary>
 /// Method that does the joining of match propagated from the JoinMatch endpoint
 /// </summary>
 public Response <bool> JoinMatch(JoinMatchRequest request)
 {
     return(AddUserMatch(request.UserId, request.MatchId));
 }