public async Task <ActionResult> EditMatch(MatchView view) { if (ModelState.IsValid) { // *** var localDateTime = Convert.ToDateTime(string.Format("{0} {1}", view.DateString, view.TimeString)); view.DateTime = localDateTime; var match = ToMatch(view); db.Entry(match).State = EntityState.Modified; var response = await DBHelper.SaveChangesAsync(db); if (response.Succeeded) { return(RedirectToAction(string.Format("DetailsDate/{0}", view.DateId))); } ModelState.AddModelError(string.Empty, response.Message); } var date = await db.Dates.FindAsync(view.DateId); ViewBag.LocalLeagueId = new SelectList(db.Leagues.OrderBy(t => t.Name), "LeagueId", "Name", view.LocalLeagueId); ViewBag.LocalId = new SelectList(db.Teams.Where(t => t.LeagueId == view.LocalLeagueId).OrderBy(t => t.Name), "TeamId", "Name", view.LocalId); ViewBag.VisitorLeagueId = new SelectList(db.Leagues.OrderBy(t => t.Name), "LeagueId", "Name", view.VisitorLeagueId); ViewBag.VisitorId = new SelectList(db.Teams.Where(t => t.LeagueId == view.VisitorLeagueId).OrderBy(t => t.Name), "TeamId", "Name", view.VisitorId); ViewBag.TournamentGroupId = new SelectList(db.TournamentGroups.Where(tg => tg.TournamentId == date.TournamentId).OrderBy(tg => tg.Name), "TournamentGroupId", "Name", view.TournamentGroupId); ViewBag.StatusId = new SelectList(db.Status.OrderBy(s => s.Name), "StatusId", "Name", view.StatusId); return(View(view)); }
public async Task <ActionResult> CreateMatch(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var date = await db.Dates.FindAsync(id); if (date == null) { return(HttpNotFound()); } ViewBag.LocalLeagueId = new SelectList(db.Leagues.OrderBy(l => l.Name), "LeagueId", "Name"); //Esto espor que ya hau una liga seleccionada ViewBag.LocalId = new SelectList(db.Teams.OrderBy(t => t.Name).Where(t => t.LeagueId == db.Leagues.FirstOrDefault().LeagueId).OrderBy(t => t.Name), "LeagueId", "Name"); //aqui tomo solo el team de la liga seleccionada ViewBag.VisitorLeagueId = new SelectList(db.Leagues.OrderBy(l => l.Name), "LeagueId", "Name"); //Esto espor que ya hau una liga seleccionada ViewBag.VisitorId = new SelectList(db.Teams.OrderBy(t => t.Name).Where(t => t.LeagueId == db.Leagues.FirstOrDefault().LeagueId).OrderBy(t => t.Name), "LeagueId", "Name"); //aqui tomo solo el team de la liga seleccionada ViewBag.TournamentGroupId = new SelectList(db.TournamentGroups.Where(tg => tg.TournamentId.Equals(date.TournamentId)).OrderBy(tg => tg.Name), "TournamentGroupId", "Name"); var view = new MatchView() { DateId = date.DateId, }; return(View(view)); }
public async Task <ActionResult> CreateMatch(MatchView view) { if (ModelState.IsValid) { view.StatusId = 1; // view.DateTime = Convert.ToDateTime(string.Format("{0} {1}", view.DateString, view.TimeString)); view.DateTime = Convert.ToDateTime($"{view.DateString} {view.TimeString}"); var match = ToMatch(view); db.Matches.Add(match); await db.SaveChangesAsync(); return(RedirectToAction($"DetailsDate/{view.DateId}")); // return RedirectToAction(string.Format("DetailsDate/{0}", view.DateId)); } var date = await db.Dates.FindAsync(view.DateId); ViewBag.LocalLeagueId = new SelectList(db.Leagues.OrderBy(t => t.Name), "LeagueId", "Name", view.LocalLeagueId); ViewBag.LocalId = new SelectList(db.Teams.Where(t => t.LeagueId == view.LocalLeagueId).OrderBy(t => t.Name), "TeamId", "Name", view.LocalId); ViewBag.VisitorLeagueId = new SelectList(db.Leagues.OrderBy(t => t.Name), "LeagueId", "Name", view.VisitorLeagueId); ViewBag.VisitorId = new SelectList(db.Teams.Where(t => t.LeagueId == view.VisitorLeagueId).OrderBy(t => t.Name), "TeamId", "Name", view.VisitorLeagueId); ViewBag.TournamentGroupId = new SelectList(db.TournamentGroups.Where(tg => tg.TournamentId == date.TournamentId).OrderBy(tg => tg.Name), "TournamentGroupId", "Name"); return(View(view)); }
// Awake is called when the script instance is being loaded private void Awake() { // Instantiate the unity event for notifying end of match MatchOver = new UnityEvent(); // Get reference to the match data provider matchData = GetComponentInParent <IMatchDataProvider>(); // Get reference to the game board board = matchData.Board; // Instantiate the array where to place the solution solution = new Pos[board.piecesInSequence]; // Get reference to the match view object view = GameObject.Find("UI")?.GetComponent <MatchView>(); // Get the AI time limit as a native C# TimeSpan aiTimeLimit = new TimeSpan( (long)(matchData.AITimeLimit * TimeSpan.TicksPerSecond)); // Setup the two players, if they are AIs (matchData.GetPlayer(PColor.White) as AIPlayer)?.Setup(); (matchData.GetPlayer(PColor.Red) as AIPlayer)?.Setup(); }
public async Task <ActionResult> CreateMatch(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var date = await db.Dates.FindAsync(id); if (date == null) { return(HttpNotFound()); } ViewBag.LocalLeagueId = new SelectList(db.Leagues.OrderBy(t => t.Name), "LeagueId", "Name"); ViewBag.LocalId = new SelectList(db.Teams.Where(t => t.LeagueId == db.Leagues.FirstOrDefault().LeagueId).OrderBy(t => t.Name), "TeamId", "Name"); ViewBag.VisitorLeagueId = new SelectList(db.Leagues.OrderBy(t => t.Name), "LeagueId", "Name"); ViewBag.VisitorId = new SelectList(db.Teams.Where(t => t.LeagueId == db.Leagues.FirstOrDefault().LeagueId).OrderBy(t => t.Name), "TeamId", "Name"); ViewBag.TournamentGroupId = new SelectList(db.TournamentGroups.Where(tg => tg.TournamentId == date.TournamentId).OrderBy(tg => tg.Name), "TournamentGroupId", "Name"); var view = new MatchView { DateId = date.DateId, }; return(View(view)); }
// Token: 0x060010E1 RID: 4321 RVA: 0x00018688 File Offset: 0x00016888 public static void Serialize(Stream stream, MatchView instance) { int num = 0; using (MemoryStream memoryStream = new MemoryStream()) { EnumProxy <GameModeType> .Serialize(memoryStream, instance.GameModeId); Int32Proxy.Serialize(memoryStream, instance.MapId); if (instance.PlayersCompleted != null) { ListProxy <PlayerStatisticsView> .Serialize(memoryStream, instance.PlayersCompleted, new ListProxy <PlayerStatisticsView> .Serializer <PlayerStatisticsView>(PlayerStatisticsViewProxy.Serialize)); } else { num |= 1; } Int32Proxy.Serialize(memoryStream, instance.PlayersLimit); if (instance.PlayersNonCompleted != null) { ListProxy <PlayerStatisticsView> .Serialize(memoryStream, instance.PlayersNonCompleted, new ListProxy <PlayerStatisticsView> .Serializer <PlayerStatisticsView>(PlayerStatisticsViewProxy.Serialize)); } else { num |= 2; } Int32Proxy.Serialize(memoryStream, instance.TimeLimit); Int32Proxy.Serialize(stream, ~num); memoryStream.WriteTo(stream); } }
// GET: Matches/Create public async Task <ActionResult> CreateMatch(int?id) { try { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var dates = await db.Dates.FindAsync(id); if (dates == null) { return(HttpNotFound()); } ViewBag.LocalLeagueId = new SelectList(db.Leagues.OrderBy(t => t.Name), "LeagueId", "Name"); ViewBag.LocalId = new SelectList(db.Teams.Where(y => y.LeagueId == db.Leagues.FirstOrDefault().LeagueId).OrderBy(t => t.Name), "TeamId", "Name"); ViewBag.VisitorLeagueId = new SelectList(db.Leagues.OrderBy(t => t.Name), "LeagueId", "Name"); ViewBag.VisitorId = new SelectList(db.Teams.Where(y => y.LeagueId == db.Leagues.FirstOrDefault().LeagueId).OrderBy(t => t.Name), "TeamId", "Name"); ViewBag.TournamentGroupId = new SelectList(db.TournamentGroups.Where(tg => tg.TournamentId == dates.TournamentId).OrderBy(x => x.Name), "TournamentGroupId", "Name"); var view = new MatchView { DateId = dates.DateId }; return(View(view)); } catch (Exception ex) { fileshelper.ErrorLogging(ex); return(View()); } }
public async Task <ActionResult> CreateMatch(MatchView view) { if (ModelState.IsValid) { view.StatusId = 1; view.DateTime = Convert.ToDateTime($"{view.DateString} {view.TimeString}"); var match = ToMach(view); db.Matches.Add(match); try { await db.SaveChangesAsync(); } catch (Exception) { } return(RedirectToAction($"DetailsDate/{match.DateId}")); } var date = await db.Dates.FindAsync(view.DateId); ViewBag.LocalLeagueId = new SelectList(db.Leagues.OrderBy(l => l.Name), "LeagueId", "Name", view.LocalId); //Esto espor que ya hau una liga seleccionada ViewBag.LocalId = new SelectList(db.Teams.Where(t => t.LeagueId.Equals(view.LocalLeagueId)).OrderBy(t => t.Name), "LeagueId", "Name", view.LocalId); //aqui tomo solo el team de la liga seleccionada ViewBag.VisitorLeagueId = new SelectList(db.Leagues.OrderBy(l => l.Name), "LeagueId", "Name", view.VisitorId); //Esto espor que ya hau una liga seleccionada ViewBag.VisitorId = new SelectList(db.Teams.Where(t => t.LeagueId.Equals(view.VisitorLeagueId)).OrderBy(t => t.Name), "LeagueId", "Name", view.VisitorId); //aqui tomo solo el team de la liga seleccionada ViewBag.TournamentGroupId = new SelectList(db.TournamentGroups.Where(tg => tg.TournamentId.Equals(date.DateId)).OrderBy(tg => tg.Name), "TournamentGroupId", "Name"); return(View(view)); }
private void Awake() { PlayerProps.Instance = new PlayerProps(0.5f); Match = new Match(); MatchView = GameObject.Find("MatchView").GetComponent <MatchView>(); MatchView.Init(Match); }
public static MatchController Create(Match match, MatchView matchView) { var userInput = new MouseAndKbInput(); var ctrl = new ClientMatchController(match, userInput); matchView.Init(match); return(ctrl); }
private static bool HasSamePlayer(MatchView firstMatchView, MatchView secondMatchView) { var firstMatchViewPlayerIds = new List <int> { firstMatchView.HomePlayer1Id, firstMatchView.HomePlayer2Id, firstMatchView.GuestPlayer1Id, firstMatchView.GuestPlayer2Id }; var secondMatchViewPlayerIds = new List <int> { secondMatchView.HomePlayer1Id, secondMatchView.HomePlayer2Id, secondMatchView.GuestPlayer1Id, secondMatchView.GuestPlayer2Id }; // When we do not have 8 different players in two matches, at least one player doest play in both matches return(firstMatchViewPlayerIds.Union(secondMatchViewPlayerIds).Count() < 8); }
private Match ToMatch(MatchView view) { return(new Match { DateId = view.DateId, DateTime = view.DateTime, LocalId = view.LocalId, StatusId = view.StatusId, TournamentGroupId = view.TournamentGroupId, VisitorId = view.VisitorId, }); }
public SearchBox() { matchView = new MatchView(this); matchView.Visible = false; matchView.View = View.List; matchView.MultiSelect = false; searchPic = new PictureBox(); searchPic.Image = oSpy.Properties.Resources.SearchImg; searchPic.Size = searchPic.PreferredSize; searchPic.Parent = this; UpdateUi(); }
public SearchBox() { matchView = new MatchView(this); matchView.Visible = false; matchView.View = View.List; matchView.MultiSelect = false; searchPic = new PictureBox(); searchPic.Image = oSpy.Properties.Resources.SearchImg; searchPic.Size = searchPic.PreferredSize; searchPic.Parent = this; UpdateUi(); }
private Match ToMatch(MatchView view) { var match = new Match { DateId = view.DateId, DateTime = Convert.ToDateTime($"{view.DateString} {view.TimeString}"), LocalId = view.LocalId, MatchId = view.MatchId, StatusId = view.StatusId, TournamentGroupId = view.TournamentGroupId, VisitorId = view.VisitorId, }; return(match); }
private Match ToMatch(MatchView view) { return(new Match { // Date = view.Date, DateId = view.DateId, DateTime = view.DateTime, // Local = view.Local, // LocalGoals = view.LocalGoals, LocalId = view.LocalId, // MatchId = view.LocalId, // Status = view.Status, StatusId = view.StatusId, TournamentGroupId = view.TournamentGroupId, VisitorId = view.VisitorId }); }
// Token: 0x060010E2 RID: 4322 RVA: 0x00018758 File Offset: 0x00016958 public static MatchView Deserialize(Stream bytes) { int num = Int32Proxy.Deserialize(bytes); MatchView matchView = new MatchView(); matchView.GameModeId = EnumProxy <GameModeType> .Deserialize(bytes); matchView.MapId = Int32Proxy.Deserialize(bytes); if ((num & 1) != 0) { matchView.PlayersCompleted = ListProxy <PlayerStatisticsView> .Deserialize(bytes, new ListProxy <PlayerStatisticsView> .Deserializer <PlayerStatisticsView>(PlayerStatisticsViewProxy.Deserialize)); } matchView.PlayersLimit = Int32Proxy.Deserialize(bytes); if ((num & 2) != 0) { matchView.PlayersNonCompleted = ListProxy <PlayerStatisticsView> .Deserialize(bytes, new ListProxy <PlayerStatisticsView> .Deserializer <PlayerStatisticsView>(PlayerStatisticsViewProxy.Deserialize)); } matchView.TimeLimit = Int32Proxy.Deserialize(bytes); return(matchView); }
public async Task <ActionResult> EditMatch(MatchView view) { if (ModelState.IsValid) { view.DateTime = Convert.ToDateTime(string.Format("{0} {1}", view.DateString, view.TimeString)); var match = ToMatch1(view); db.Entry(match).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction(string.Format("DetailsDate/{0}", view.DateId))); } ViewBag.StatusId = new SelectList(db.Status, "StatusId", "Name", view.StatusId); ViewBag.LocalLeagueId = new SelectList(db.Leagues.OrderBy(t => t.Name), "LeagueId", "Name", view.Local.LeagueId); ViewBag.LocalId = new SelectList(db.Teams.Where(t => t.LeagueId == view.Local.LeagueId).OrderBy(t => t.Name), "TeamId", "Name", view.LocalId); ViewBag.VisitorLeagueId = new SelectList(db.Leagues.OrderBy(t => t.Name), "LeagueId", "Name", view.Visitor.LeagueId); ViewBag.VisitorId = new SelectList(db.Teams.Where(t => t.LeagueId == view.Visitor.LeagueId).OrderBy(t => t.Name), "TeamId", "Name", view.VisitorId); ViewBag.TournamentGroupId = new SelectList(db.TournamentGroups.Where(tg => tg.TournamentId == view.Date.TournamentId).OrderBy(tg => tg.Name), "TournamentGroupId", "Name", view.TournamentGroupId); return(View(view)); }
public async Task <ActionResult> EditMatch(MatchView view) { if (ModelState.IsValid) { var match = ToMatch(view); db.Entry(match).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction(string.Format("DetailsDate/{0}", view.DateId))); } var date = await db.Dates.FindAsync(view.DateId); ViewBag.LocalLeagueId = new SelectList(db.Leagues.OrderBy(t => t.Name), "LeagueId", "Name", view.LocalLeagueId); ViewBag.LocalId = new SelectList(db.Teams.Where(t => t.LeagueId == db.Leagues.FirstOrDefault().LeagueId).OrderBy(t => t.Name), "TeamId", "Name", view.LocalId); ViewBag.VisitorLeagueId = new SelectList(db.Leagues.OrderBy(t => t.Name), "LeagueId", "Name", view.VisitorLeagueId); ViewBag.VisitorId = new SelectList(db.Teams.Where(t => t.LeagueId == db.Leagues.FirstOrDefault().LeagueId).OrderBy(t => t.Name), "TeamId", "Name", view.VisitorId); ViewBag.TournamentGroupId = new SelectList(db.TournamentGroups.Where(tg => tg.TournamentId == date.TournamentId).OrderBy(tg => tg.Name), "TournamentGroupId", "Name", view.TournamentGroupId); return(View(view)); }
public async Task <ActionResult> CreateMatch(MatchView view) { if (ModelState.IsValid) { var match = ToMatch(view); db.Matches.Add(match); await db.SaveChangesAsync(); return(RedirectToAction($"DetailDate/{match.DateId}")); } ViewBag.LocalLeagueId = new SelectList(db.Leagues.OrderBy(t => t.Name), "LeagueId", "Name"); ViewBag.LocalId = new SelectList(db.Teams.Where(t => t.LeagueId == view.LocalId), "TeamId", "Name", view.LocalId); ViewBag.VisitorLeagueId = new SelectList(db.Leagues.OrderBy(t => t.Name), "LeagueId", "Name"); ViewBag.VisitorId = new SelectList(db.Teams.Where(t => t.LeagueId == view.VisitorId), "TeamId", "Name", view.VisitorId); ViewBag.TournamentGroupId = new SelectList(db.TournamentGroups.Where(tg => tg.TournamentId == view.Date.TournamentId).OrderBy(tg => tg.Name), "TournamentGroupId", "Name"); return(View(view)); }
public async Task <ActionResult> CreateMatch(MatchView view) { try { if (view.DateString == null) { ShowMessage(); return(RedirectToAction(string.Format("DetailsDate/{0}", view.DateId))); } if (ModelState.IsValid) { view.StatusId = 1; view.DateTime = Convert.ToDateTime(string.Format("{0} {1}", view.DateString, view.TimeString)); var match = ToMatch(view); db.Matches.Add(match); await db.SaveChangesAsync(); return(RedirectToAction(string.Format("DetailsDate/{0}", match.DateId))); } ViewBag.LocalLeagueId = new SelectList(db.Leagues.OrderBy(t => t.Name), "LeagueId", "Name", view.LocalLeagueId); ViewBag.LocalId = new SelectList(db.Teams.Where(y => y.LeagueId == view.LocalLeagueId).OrderBy(t => t.Name), "TeamId", "Name", view.LocalId); ViewBag.VisitorLeagueId = new SelectList(db.Leagues.OrderBy(t => t.Name), "LeagueId", "Name", view.VisitorLeagueId); ViewBag.VisitorId = new SelectList(db.Teams.Where(y => y.LeagueId == view.VisitorLeagueId).OrderBy(t => t.Name), "TeamId", "Name", view.VisitorId); ViewBag.TournamentGroupId = new SelectList(db.TournamentGroups.Where(tg => tg.TournamentGroupId == view.TournamentGroupId).OrderBy(x => x.Name), "TournamentGroupId", "Name"); return(View(view)); } catch (Exception ex) { fileshelper.ErrorLogging(ex); return(RedirectToAction(string.Format("DetailsDate/{0}", view.DateId))); throw; } }
private static bool IsPlayerInMatch(MatchView matchView, int playerId) { return(matchView.HomePlayer1Id == playerId || matchView.HomePlayer2Id == playerId || matchView.GuestPlayer1Id == playerId || matchView.GuestPlayer2Id == playerId); }
public List <MatchView> CreateMatchViews(EventList list, bool isFixture, bool detailedDate) { List <MatchView> matchList = new List <MatchView>(); if (list == null) { return(matchList); } foreach (var @event in list.events) { string minute = @event.Value.startdate.Minute < 10 ? $"0{@event.Value.startdate.Minute.ToString()}" : (@event.Value.startdate.Minute.ToString()); var detailedDateString = string.Empty; if (detailedDate) { var month = @event.Value.startdate.Month < 10 ? $"0{@event.Value.startdate.Month.ToString()}" : @event.Value.startdate.Month.ToString(); var day = @event.Value.startdate.Day < 10 ? $"0{@event.Value.startdate.Day.ToString()}" : @event.Value.startdate.Day.ToString(); detailedDateString = $"{@event.Value.startdate.Year}.{month}.{day} {@event.Value.startdate.Hour}:{minute}"; } var homeTeam = @event.Value.event_participants.Values.ElementAt(0); var guestTeam = @event.Value.event_participants.Values.ElementAt(1); string homeTeamAS = null, guestTeamAS = null; if (homeTeam.result.Values.Where(a => a.result_code == "runningscore").SingleOrDefault() != null) { // Getting Actual Score ("runningscore") homeTeamAS = homeTeam.result.Values.Where(a => a.result_code == "runningscore").Select(a => a.value).ElementAt(0); guestTeamAS = guestTeam.result.Values.Where(a => a.result_code == "runningscore").Select(a => a.value).ElementAt(0); } string homeTeamFS = null, guestTeamFS = null; if (homeTeam.result.Values.Where(a => a.result_code == "finalresult").SingleOrDefault() != null) { // Getting Final Result ("finalresult") homeTeamFS = homeTeam.result.Values.Where(a => a.result_code == "finalresult").Select(a => a.value).ElementAt(0); guestTeamFS = guestTeam.result.Values.Where(a => a.result_code == "finalresult").Select(a => a.value).ElementAt(0); } string elapsedTime = null; if (@event.Value.elapsed != null) { elapsedTime = @event.Value.elapsed.Values.ElementAt(0).elapsed + "'"; } MatchView actualMatch = new MatchView() { EventId = @event.Key, HomeTeam = homeTeam, GuestTeam = guestTeam, StartingDate = (detailedDate) ? detailedDateString : $"{@event.Value.startdate.Hour}:{minute}", RunningScore = (isFixture) ? " - " : $"{homeTeamAS} - {guestTeamAS}", FinalScore = $"{homeTeamFS} - {guestTeamFS}", Elapsed = elapsedTime, HomeTeamFinalScore = homeTeamFS, GuestTeamFinalScore = guestTeamFS, HomeTeamRunningScore = homeTeamAS, GuestTeamRunningScore = guestTeamAS }; matchList.Add(actualMatch); } return(matchList.OrderBy(m => m.StartingDate).ToList()); }