public void GoodAndBadFixtureFeedback(List <Fixture> fixtures) { ManagerAdapter ma = new ManagerAdapter(); EmailAdapter ea = new EmailAdapter(); foreach (Manager m in ma.GetHumanManagers()) { foreach (Fixture f in fixtures) { for (int team = 0; team <= 1; team++) { if (f.TeamIDs[team] == m.CurrentTeam) // Find manager's team { int opp = 1 - team; // Opposition team if (Math.Abs(f.Score[team] - f.Score[opp]) >= 3) { if (f.Score[team] > f.Score[opp]) { ea.SendEmail(m.UniqueID, EmailType.GoodMatch, new List <int>() { f.Score[0], f.Score[1], f.TeamIDs[opp] }); } if (f.Score[team] < f.Score[opp]) { ea.SendEmail(m.UniqueID, EmailType.BadMatch, new List <int>() { f.Score[0], f.Score[1], f.TeamIDs[opp] }); } } } } } } }
private void NextManagerOrContinueDay() { ManagerAdapter ma = new ManagerAdapter(); FixtureAdapter fa = new FixtureAdapter(); WorldAdapter wa = new WorldAdapter(); TeamAdapter ta = new TeamAdapter(); if (HumanManagers == null) { // Going to first manager, which means we have to run Start Of Day, unless loading from a savegame if (!SaveGameJustLoaded) { RunProcesses(false); } else { SaveGameJustLoaded = false; } HumanManagers = ma.GetHumanManagers(); PlayingHumanManager = 0; wa.CurrentManagerID = HumanManagers[PlayingHumanManager].UniqueID; if (HumanManagers.Count() < 1) { throw new Exception("No human managers"); } } else { // Check selections if a matchday if (fa.IsTodayAMatchDay(HumanManagers[PlayingHumanManager].CurrentTeam)) { const int REQUIREDCOUNT = 11; int PlayerCount = ta.CountSelectedPlayers(HumanManagers[PlayingHumanManager].CurrentTeam); if (PlayerCount < REQUIREDCOUNT) { UiUtils.OpenDialogBox(UiUtils.MainWindowGrid, LangResources.CurLang.MatchDay, string.Format(LangResources.CurLang.YouHaveNotSelectedEnoughPlayers, PlayerCount, REQUIREDCOUNT), new List <DialogButton>() { new DialogButton(LangResources.CurLang.OK, null, null) }); return; } } // Go to next human manager PlayingHumanManager++; if (PlayingHumanManager >= HumanManagers.Count()) { HumanManagers = null; wa.CurrentManagerID = -1; } else { wa.CurrentManagerID = HumanManagers[PlayingHumanManager].UniqueID; } } if (HumanManagers != null) { // Display home screen for the current manager Manager PlayingManager = HumanManagers[PlayingHumanManager]; ShowHomeScreenForCurrentManager(PlayingManager); if (fa.IsTodayAMatchDay(PlayingManager.CurrentTeam)) { Fixture f = fa.GetNextFixture(PlayingManager.CurrentTeam, wa.CurrentDate); int Opposition = (f.TeamIDs[0] != PlayingManager.CurrentTeam ? f.TeamIDs[0] : f.TeamIDs[1]); string Message = string.Format(LangResources.CurLang.YouHaveAMatchAgainst, ta.GetTeam(Opposition).Name); UiUtils.OpenDialogBox(UiUtils.MainWindowGrid, LangResources.CurLang.MatchDay, Message, new List <DialogButton>() { new DialogButton(LangResources.CurLang.OK, null, null) }); } } else { if (fa.IsTodayAMatchDay()) { ShowGameScreen(new MatchdayMain(), true); } else { RunProcesses(true); } } }