public JsonController() { Result = new Result(); countryUtil = new CountryUtil(); stateUtil = new StateUtil(); areaUtil = new AreaUtil(); userUtil = new UserUtil(); subareaUtil = new SubAreaUtil(); appointmentTypeUtil = new AppointmentTypeUtil(); currencyUtil = new CurrencyUtil(); dateFormatUtil = new DateFormatUtil(); languageUtil = new LanguageUtil(); religionUtil = new ReligionUtil(); durationDaysUtil = new DurationDaysUtil(); sourceUtil = new SourceUtil(); packageUtil = new PackageUtil(); cityUtil = new CityUtil(); //scoreColumnUtil = new ScoreColumnUtil(); nationalityUtil = new NationalityUtil(); timeFormatUtil = new TimeFormatUtil(); industryUtil = new IndustryUtil(); paymentModeUtil = new PaymentModeUtil(); applicationTemplatePlaceHolderUtil = new ApplicationTemplatePlaceHolderUtil(); jobTypeUtill = new JobTypeUtill(); jobStatusUtill = new JobStatusUtill(); packageTypeUtill = new PackageTypeUtill(); paperTypeUtill = new PaperTypeUtill(); paperSubTypeUtill = new PaperSubTypeUtill(); paymentStatusUtill = new PaymentStatusUtill(); currencyUtil = new CurrencyUtil(); leminationTypeUtill = new LeminationTypeUtill(); }
public MastersController() { result = new Result(); countryUtil = new CountryUtil(); stateUtil = new StateUtil(); cityUtil = new CityUtil(); areaUtil = new AreaUtil(); subareaUtil = new SubAreaUtil(); appointmentTypeUtil = new AppointmentTypeUtil(); currencyUtil = new CurrencyUtil(); dateFormatUtil = new DateFormatUtil(); documentTypeUtil = new DocumentTypeUtil(); languageUtil = new LanguageUtil(); religionUtil = new ReligionUtil(); nationalityUtil = new NationalityUtil(); sourceUtil = new SourceUtil(); durationDaysUtil = new DurationDaysUtil(); packageUtil = new PackageUtil(); // scoreColumnUtil = new ScoreColumnUtil(); timeFormatUtil = new TimeFormatUtil(); industryUtil = new IndustryUtil(); paymentModeUtil = new PaymentModeUtil(); applicationTemplatePlaceHolderUtil = new ApplicationTemplatePlaceHolderUtil(); }
// declay member of poly and init Vector2[]; // [ rect ] public static bool IsInsideRect(Vector2[] poly, Transform[] trans, Vector2 target) { poly[0] = AreaUtil.GetV2(trans[0]); poly[1] = AreaUtil.GetV2(trans[1]); poly[2] = AreaUtil.GetV2(trans[2]); poly[3] = AreaUtil.GetV2(trans[3]); //Vector2 t = AreaUtil.GetV2(target); return(AreaUtil.IsInsidePoly(poly, target)); }
public bool IsInsideRect(Vector2[] poly, Transform[] trans) { GetPos(); var a = AreaUtil.IsInsideRect(poly, trans, new Vector2(pos[0].x, pos[0].z)); var b = AreaUtil.IsInsideRect(poly, trans, new Vector2(pos[1].x, pos[1].z)); var c = AreaUtil.IsInsideRect(poly, trans, new Vector2(pos[2].x, pos[2].z)); var d = AreaUtil.IsInsideRect(poly, trans, new Vector2(pos[3].x, pos[3].z)); return(a || b || c || d); }
public List <Team> TeamProvide() { string playerRaw = System.IO.File.ReadAllText(filePlayerName); string[] playerLines = playerRaw.Split('\n'); List <Player> players = new List <Player>(); for (int i = 0; i < playerLines.Length; i++) { string[] tokens = playerLines[i].Split(';'); players.Add(new Player() { Name = tokens[0], Nation = tokens[1], Score = 0 }); } string data = System.IO.File.ReadAllText(fileCountriesName); string[] lines = data.Split('\n'); List <Team> teamList = new List <Team>(); for (int i = 0; i < lines.Length; i++) { string[] tokens = lines[i].Split(';'); List <Player> listPlayer = players.Where(player => player.Nation.Trim().ToLower() == tokens[1].Trim().ToLower()).ToList(); while (listPlayer.Count < MaximumPlayer) { listPlayer.Add(new Player() { Name = "PPlayer#" + (1000 + rand.Next(0, 9999)), Nation = tokens[1], Role = tokens[2], Score = 0 }); } while (listPlayer.Count > MaximumPlayer) { listPlayer.RemoveAt(rand.Next(0, listPlayer.Count)); } Team team = new Team() { Code = tokens[0], Name = tokens[1], Area = AreaUtil.GetAreaFromString(tokens[2].Trim()), TotalScore = 0, PlayerList = listPlayer }; teamList.Add(team); } return(teamList); }
public List <Team> TeamProvide() { List <Team> result = new List <Team>(); List <Player> players = new List <Player>(); command = new SQLiteCommand("SELECT * FROM Players", connection); dataReader = command.ExecuteReader(); while (dataReader.Read()) { players.Add(new Player() { Name = dataReader.GetValue(0).ToString(), Nation = dataReader.GetValue(1).ToString(), Role = dataReader.GetValue(2).ToString(), }); } command = new SQLiteCommand("SELECT * FROM Countries", connection); dataReader = command.ExecuteReader(); while (dataReader.Read()) { string[] tokens = new string[] { dataReader.GetValue(0).ToString(), dataReader.GetValue(1).ToString(), dataReader.GetValue(2).ToString() }; List <Player> listPlayer = players.Where(player => player.Nation.Trim().ToLower() == tokens[1].Trim().ToLower()).ToList(); while (listPlayer.Count < MaximumPlayer) { listPlayer.Add(new Player() { Name = "PPlayer#" + (1000 + rand.Next(0, 9999)), Nation = tokens[1], Score = 0, Role = tokens[2] }); } while (listPlayer.Count > MaximumPlayer) { listPlayer.RemoveAt(rand.Next(0, listPlayer.Count)); } Team team = new Team() { Code = tokens[0], Name = tokens[1], Area = AreaUtil.GetAreaFromString(tokens[2].Trim()), TotalScore = 0, PlayerList = listPlayer }; result.Add(team); } connection.Close(); return(result); }
public bool isWithinCircle(Transform origin, float angle, float radius) { GetPos(); bool b = false; for (int i = 0; i < 4; i++) { if (AreaUtil.isWithinCircle(pos[i], origin, angle, radius)) { return(true); } } return(b); }
public override List <Team> Play() { Random rand = new Random(); List <Team> result = new List <Team>(); Array arr = Enum.GetValues(typeof(Area)); List <Team> waiting = new List <Team>(); foreach (Area area in arr) { List <Team> countryInContinent = InputTeams.Where((team) => team.Area == area).ToList(); bool isFloor = rand.Next(0, 1) == 0 ? true : false; double rate = AreaUtil.GetRateFromArea(area); int max = 0; if (isFloor) { max = Convert.ToInt32(Math.Round((decimal)rate, 1)); } else { max = (int)rate; } while (max > 0 && result.Count < 32 && countryInContinent.Count > 0) { int selectionId = rand.Next(0, countryInContinent.Count); result.Add(countryInContinent[selectionId]); countryInContinent.RemoveAt(selectionId); max--; } if (!isFloor) { waiting.Add(countryInContinent[0]); } } while (result.Count < 32 && waiting.Count > 0) { result.Add(waiting[0]); waiting.RemoveAt(0); } return(result); }
public void GetAreaFromString() { Assert.AreEqual(AreaUtil.GetAreaFromString("Asia"), Area.Asia); }
public void OceaniaRateIsCorrect() { Assert.AreEqual(true, AreaUtil.GetRateFromArea(Area.Oceania) == 0.5d); }
public void SouthAmericaRateIsCorrect() { Assert.AreEqual(true, AreaUtil.GetRateFromArea(Area.SouthAmerica) == 3.5d); }
public void AfricaRateIsCorrect() { Assert.AreEqual(true, AreaUtil.GetRateFromArea(Area.Africa) == 5d); }
public void EuropeRateIsCorrect() { Assert.AreEqual(true, AreaUtil.GetRateFromArea(Area.Europe) == 13d); }