예제 #1
0
        public IActionResult UpdateServerSelection([FromBody] IEnumerable <int> selectedServers)
        {
            var steamId = UserExtensions.GetSteamId(this.User);

            _matchmakingService.UpdateServerSelection(steamId, selectedServers);
            return(Ok());
        }
예제 #2
0
        public IActionResult UpdateMatchmakingPreference([FromBody] int matchMakingPreference)
        {
            var steamId = UserExtensions.GetSteamId(this.User);

            _matchmakingService.UpdatePreference(steamId, matchMakingPreference);
            return(Ok());
        }
예제 #3
0
        public IActionResult UpdateCollegiateChecked([FromBody] bool collegiateChecked)
        {
            var steamId = UserExtensions.GetSteamId(this.User);

            _matchmakingService.UpdateCollegiateSelected(steamId, collegiateChecked);
            return(Ok());
        }
예제 #4
0
        public IActionResult DeclineMatch()
        {
            var steamId = UserExtensions.GetSteamId(this.User);

            _matchmakingService.DeclineMatch(steamId);
            return(Ok());
        }
예제 #5
0
        public IActionResult CancelSearch()
        {
            var steamId = UserExtensions.GetSteamId(this.User);

            _matchmakingService.CancelSearch(steamId);
            return(Ok());
        }
예제 #6
0
        public IActionResult SendMessage([FromBody] string message)
        {
            var steamId = UserExtensions.GetSteamId(this.User);

            _matchmakingService.SendMessage(steamId, message);
            return(Ok());
        }
예제 #7
0
        public IActionResult LeaveLobby()
        {
            var steamId = UserExtensions.GetSteamId(this.User);

            _matchmakingService.LeaveLobby(steamId);
            return(Ok());
        }
예제 #8
0
 public LobbyInfo GetLobbyInfo([FromBody] int eventId)
 {
     if (this.User.Identity.IsAuthenticated)
     {
         var steamId = UserExtensions.GetSteamId(this.User);
         return(_schedulingService.GetLobbyInfo(eventId, steamId));
     }
     return(null);
 }
예제 #9
0
 public MatchmakingData GetExistingLobbyInfo()
 {
     if (this.User.Identity.IsAuthenticated)
     {
         var steamId = UserExtensions.GetSteamId(this.User);
         return(_matchmakingService.GetExistingLobbyInfo(steamId));
     }
     return(null);
 }
예제 #10
0
 public bool IsQueued()
 {
     if (this.User.Identity.IsAuthenticated)
     {
         var steamId = UserExtensions.GetSteamId(this.User);
         return(_matchmakingService.GetIsQueued(steamId));
     }
     return(false);
 }
예제 #11
0
 public IActionResult DeleteEvent([FromBody] int id)
 {
     if (this.User.Identity.IsAuthenticated)
     {
         var steamId = UserExtensions.GetSteamId(this.User);
         _schedulingService.DeleteEvent(steamId, id);
         return(Ok());
     }
     return(Unauthorized());
 }
예제 #12
0
        public override Task OnConnectedAsync()
        {
            if (Context.User.Identity.IsAuthenticated)
            {
                var steamId = UserExtensions.GetSteamId(Context.User);
                UserConnections.Add(steamId, Context.ConnectionId);
            }

            return(base.OnConnectedAsync());
        }
예제 #13
0
        public override Task OnDisconnectedAsync(Exception ex)
        {
            if (Context.User.Identity.IsAuthenticated)
            {
                var steamId = UserExtensions.GetSteamId(Context.User);
                UserConnections.Remove(steamId, Context.ConnectionId);
            }

            return(base.OnDisconnectedAsync(ex));
        }
예제 #14
0
 public IActionResult SendMessage([FromBody] ChatMessage message)
 {
     if (this.User.Identity.IsAuthenticated)
     {
         var steamId = UserExtensions.GetSteamId(this.User);
         message.SteamId = steamId;
         message.Sent    = DateTime.Now;
         _schedulingService.AddMessage(message);
         return(Ok());
     }
     return(Unauthorized());
 }
예제 #15
0
 public ScrimEventViewModel AddEvent([FromBody] ScrimEvent scrimEvent)
 {
     if (this.User.Identity.IsAuthenticated)
     {
         var steamId = UserExtensions.GetSteamId(this.User);
         scrimEvent.SteamId = steamId;
         var newEvent          = _schedulingService.AddEvent(scrimEvent);
         var newEventViewModel = this.GetEventViewModel(newEvent);
         _schedulingService.NotifyEventAdded(newEventViewModel);
         return(newEventViewModel);
     }
     return(null);
 }
예제 #16
0
 public UserInfo GetUserInfo()
 {
     if (this.User.Identity.IsAuthenticated)
     {
         var steamId   = UserExtensions.GetSteamId(this.User);
         var steamInfo = _steamService.GetSteamInfo(steamId);
         var userName  = steamInfo.FirstOrDefault(u => u.Name == "personaname")?.Value;
         var mmr       = _trackerService.GetMmr(steamId).Result;
         return(new UserInfo {
             SteamId = steamId, DisplayName = userName, Mmr = mmr
         });
     }
     return(null);
 }
예제 #17
0
 public IEnumerable <ScrimEventViewModel> GetScrimEvents()
 {
     if (this.User.Identity.IsAuthenticated)
     {
         var steamId     = UserExtensions.GetSteamId(this.User);
         var scrimEvents = _schedulingService.GetScrimEvents(steamId);
         var viewModels  = new List <ScrimEventViewModel>();
         foreach (var scrimEvent in scrimEvents)
         {
             viewModels.Add(this.GetEventViewModel(scrimEvent));
         }
         return(viewModels);
     }
     return(null);
 }
예제 #18
0
        public IActionResult StartSearch([FromBody] UserInfo userInfo)
        {
            var steamId = UserExtensions.GetSteamId(this.User);

            if (string.IsNullOrWhiteSpace(steamId) || !userInfo.Servers.Any())
            {
                return(BadRequest());
            }
            var mmr = _trackerService.GetMmr(steamId).Result;

            userInfo.SteamId = steamId;
            userInfo.Mmr     = mmr;
            _matchmakingService.StartSearch(userInfo);
            return(Ok());
        }
예제 #19
0
 public ScrimRequestViewModel RequestEvent([FromBody] int id)
 {
     if (this.User.Identity.IsAuthenticated)
     {
         var steamId = UserExtensions.GetSteamId(this.User);
         var request = new ScrimRequest
         {
             ScrimEventId = id,
             Date         = DateTime.Now,
             SteamId      = steamId
         };
         var newRequest          = _schedulingService.AddRequest(request);
         var newRequestViewModel = this.GetRequestViewModel(newRequest);
         _schedulingService.NotifyRequestAdded(id, newRequestViewModel);
         return(newRequestViewModel);
     }
     return(null);
 }