Ejemplo n.º 1
0
        public ActionResult Watch(string serverName, double startTimeSeconds)
        {
            var cameraOptions  = new List <SelectListItem>();
            var gameRecordings = _gameRecordingsGetter.Get(serverName, startTimeSeconds);

            foreach (var gameRecording in gameRecordings)
            {
                var bkaData = _bkaDataGetter.Get(gameRecording.PlayerId);
                if (!string.IsNullOrWhiteSpace(bkaData?.Bka))
                {
                    var    playedGame     = _playedGamesGetter.Get("ns2", gameRecording.PlayerId).SingleOrDefault(x => x.ServerName.Equals(serverName) && x.StartTimeSeconds.Equals(startTimeSeconds));
                    string cameraTeamInfo = null;
                    if (playedGame != null)
                    {
                        if (playedGame.GameMode == "ns2")
                        {
                            var team = playedGame.MarineSeconds > playedGame.AlienSeconds ? "M" : "A";
                            var comm = playedGame.CommanderSeconds > playedGame.DurationInSeconds / 2 ? "C" : string.Empty;
                            cameraTeamInfo = $"{team}{comm}";
                        }
                    }
                    else
                    {
                        cameraTeamInfo = "S";
                    }
                    var cameraDisplay = $"{bkaData.Bka}";
                    if (!string.IsNullOrWhiteSpace(cameraTeamInfo))
                    {
                        cameraDisplay = $"{cameraDisplay} ({cameraTeamInfo})";
                    }
                    cameraOptions.Add(new SelectListItem {
                        Value = gameRecording.VideoIdentifier, Text = cameraDisplay
                    });
                }
            }
            return(View(new RecordingWatchViewModel {
                CameraOptions = cameraOptions
            }));
        }
        public IEnumerable <string> GetCameraViewNames(string serverName, double startTimeSeconds)
        {
            var result         = new List <string>();
            var gameRecordings = _gameRecordingsGetter.Get(serverName, startTimeSeconds);

            foreach (var playedGame in gameRecordings.Select(gameRecording => _playedGamesGetter.Get("ns2", gameRecording.PlayerId).SingleOrDefault(x => x.ServerName.Equals(serverName) && x.StartTimeSeconds.Equals(startTimeSeconds))))
            {
                string cameraViewName;
                if (playedGame != null)
                {
                    var team = playedGame.MarineSeconds > playedGame.AlienSeconds ? "M" : "A";
                    var comm = playedGame.CommanderSeconds > playedGame.DurationInSeconds / 2 ? "C" : string.Empty;
                    cameraViewName = $"{team}{comm}";
                }
                else
                {
                    cameraViewName = "S";
                }
                result.Add(cameraViewName);
            }
            return(result);
        }
Ejemplo n.º 3
0
        public ActionResult Index()
        {
            var playedGames = _playedGamesGetter.Get("ns2", PlayerId).Where(x => x.Created > DateTime.Now.AddDays(-14)).OrderByDescending(x => x.Created);

            return(View(playedGames));
        }