private PreGarment CreatePreGarment(Silouhette s, ColorFamily cf, PatternType pt) { PreGarment g = new PreGarment(); g.PreSilouhette = s.PreSilouhette; g.ColorFamily = cf; g.PatternType = pt; return(g); }
// Returns true if the colors matches in the game rules, false otherwise. static public bool colors_matches(ColorFamily left_color, ColorFamily right_color) { // Whites matches all colors if (left_color == ColorFamily.Whites || right_color == ColorFamily.Whites) { return(true); } // Blacks matches with no colors, not even blacks. if (left_color == ColorFamily.Blacks || right_color == ColorFamily.Blacks) { return(false); } // Other colors only matches their own familly return(left_color == right_color); }
public OutfitUpdater(int id, string name, string keywords, string description, string externalId, double price, string buyUrl, string imageUrl, int partnerId, int silouhetteId, int patternId, int colorFamilyId, int status) { this.Id = id; this.name = name; this.description = description; this.keywords = keywords; this.externalId = externalId; if (price > 0) { this.price = Convert.ToDecimal(price); } this.buyUrl = buyUrl; this.imageUrl = imageUrl; this.partner = new Partner(partnerId); this.silouhette = new Silouhette(silouhetteId); this.pattern = new Pattern(patternId); this.colorFamily = new ColorFamily(colorFamilyId); this.status = (OutfitUpdaterStatus)status; }
public IList <OutfitUpdater> GetFor(Silouhette silouhette, ColorFamily colorFamily, int pageNumber, int pageSize, out int totalCount) { ICriteria crit = Session.CreateCriteria(typeof(OutfitUpdater)); crit.Add(Expression.Eq("Season", SeasonHelper.CurrentSeason)); crit.CreateCriteria("Silouhette").Add(Expression.Eq("Id", silouhette.Id)); crit.Add(Expression.Not(Expression.Ge("Status", OutfitUpdaterStatus.Valid))); totalCount = crit.SetProjection(Projections.ProjectionList().Add(Projections.Count("Id"))).UniqueResult <int>(); string sizeandpage = pageSize.ToString(); if (pageNumber > 1) { sizeandpage += ", " + pageSize; } string query = string.Format("SELECT ou.outfitupdaterid, ou.description, ou.name, ou.price, ou.buyurl, ou.imageurl, p.Code, p.Name, ou.silouhetteid FROM outfitupdaters ou inner join partners p ON ou.PartnerId = p.PartnerId inner join silouhettes s ON ou.SilouhetteId = s.SilouhetteId WHERE ou.Status >= {0} and ou.Season = {3} and s.CategoryId = {1} ORDER BY RAND() LIMIT {2};", Convert.ToInt32(OutfitUpdaterStatus.Valid), silouhette.Category.Id, sizeandpage, (int)SeasonHelper.CurrentSeason); IQuery q = Session.CreateSQLQuery(query); q.SetResultTransformer(new NHibernate.Transform.AliasToBeanConstructorResultTransformer(typeof(OutfitUpdater).GetConstructors()[3])); return(q.List <OutfitUpdater>()); }
public static Color32 GetColor(ColorFamily colorFamily, List<Color32> usedColors) { Color32 color; double difference; var atempts = 0; do { atempts++; color = GetColor(colorFamily); difference = CompareColorWithUsedColors(usedColors, color); } while (difference < Configuration.Instance.MinColorDiffPercentage && (atempts < Configuration.Instance.MaxDiffColorPickAttempt)); if (difference <= 0) { foreach (var usedColor in usedColors) { var differentColorFound = false; foreach (var colorItem in _colors[colorFamily]) { if (!usedColor.IsColorEqual(colorItem)) { color = colorItem; differentColorFound = true; logger.Message(string.Format("Color not repeated: {0} Color2: {2} Diference: {1}", color, CompareColorWithUsedColors(usedColors, color), usedColor)); break; } } if (differentColorFound) break; } } logger.Message(string.Format("Diference: {0} Atempts: {1}", difference, atempts)); return color; }
public static Color32 GetColor(ColorFamily colorFamily, List <Color32> usedColors) { Color32 color; double difference; var atempts = 0; do { atempts++; color = GetColor(colorFamily); difference = CompareColors(color, usedColors.First()); foreach (var usedColor in usedColors) { var auxDifference = CompareColors(color, usedColor); if (auxDifference < difference) { difference = auxDifference; } } Console.Message(string.Format("Diference: {0}", difference)); } while (difference < Configuration.Instance.MinimumColorDifferencePercentage && (atempts < Configuration.Instance.MaximunDifferentCollorPickAtempt)); return(color); }
public OutfitUpdater(int Id, Silouhette s, ColorFamily c, Pattern p) { this.silouhette = s; this.colorFamily = c; this.pattern = p; }
public static Color32 GetColor(ColorFamily colorFamily) { return(_colors[colorFamily][Random.Range(0, _colors[colorFamily].Length - 1)]); }
public static Color32 GetColor(ColorFamily colorFamily) { return _colors[colorFamily][Random.Range(0, _colors[colorFamily].Length - 1)]; }
public static void Initialize(CeramicsContext context) { context.Database.EnsureCreated(); // Look for any students. if (context.Customer.Any()) { return; // DB has been seeded } var customers = new Customer[] { new Customer { FirstMidName = "Sodom", LastName = "Lee", OrderDate = DateTime.Parse("2020-12-11") }, new Customer { FirstMidName = "Rachel", LastName = "Buse", OrderDate = DateTime.Parse("2020-12-01") }, new Customer { FirstMidName = "Heather", LastName = "Whittlesey", OrderDate = DateTime.Parse("2020-11-01") }, new Customer { FirstMidName = "Alexis", LastName = "Dwyer", OrderDate = DateTime.Parse("2020-12-11") }, new Customer { FirstMidName = "Jeff", LastName = "Miller", OrderDate = DateTime.Parse("2020-12-01") }, new Customer { FirstMidName = "Lyndsay", LastName = "Nissen", OrderDate = DateTime.Parse("2020-11-01") }, new Customer { FirstMidName = "Edgar", LastName = "Camacho", OrderDate = DateTime.Parse("2020-12-01") }, new Customer { FirstMidName = "Cody", LastName = "Ryan", OrderDate = DateTime.Parse("2020-09-01") } }; foreach (Customer cu in customers) { context.Customer.Add(cu); } context.SaveChanges(); var colors = new Color[] { new Color { ColorID = 6002, ColorName = "Rose Pink", Price = 25.55 }, new Color { ColorID = 6121, ColorName = "Saturn Orange", Price = 14.18 }, new Color { ColorID = 6404, ColorName = "Vanadium", Price = 32.27 }, new Color { ColorID = 6166, ColorName = "Camel Beige", Price = 14.00 }, new Color { ColorID = 6006, ColorName = "Deep Crimson", Price = 25.00 }, new Color { ColorID = 6020, ColorName = "Alumina Pink", Price = 14.45 }, new Color { ColorID = 6126, ColorName = "Hazelnut", Price = 17.27 } }; foreach (Color co in colors) { context.Color.Add(co); } context.SaveChanges(); var orders = new Order[] { new Order { ColorID = 6002, CustomerID = 0001, MembershipStat = MembershipStat.A }, new Order { ColorID = 6121, CustomerID = 0002, MembershipStat = MembershipStat.C }, new Order { ColorID = 6404, CustomerID = 0003, MembershipStat = MembershipStat.B }, new Order { ColorID = 6002, CustomerID = 0004, MembershipStat = MembershipStat.A }, new Order { ColorID = 6166, CustomerID = 0005, MembershipStat = MembershipStat.C }, new Order { ColorID = 6006, CustomerID = 0006, MembershipStat = MembershipStat.B }, new Order { ColorID = 6166, CustomerID = 0007, MembershipStat = MembershipStat.C }, new Order { ColorID = 6006, CustomerID = 0008, MembershipStat = MembershipStat.B } }; foreach (Order o in orders) { context.Order.Add(o); } context.SaveChanges(); var chemistry = new Chemistry[] { new Chemistry { ID = 9001, ChemComp = "Chromium, Strontium", ChemAbbrev = "CrSn", ColorID = 6002 }, new Chemistry { ID = 9002, ChemComp = "Chromium, Iron, Zinc, Aluminum, Silicon", ChemAbbrev = "CrFeZnAlSi", ColorID = 6121 }, new Chemistry { ID = 9003, ChemComp = "Strontium, Vanadium", ChemAbbrev = "SnV", ColorID = 6404 }, new Chemistry { ID = 9004, ChemComp = "Chromium, Iron, Zinc, Aluminum, Cobalt, Manganese", ChemAbbrev = "CrFeZnAlCoMn", ColorID = 6166 }, new Chemistry { ID = 9005, ChemComp = "Manganese, Aluminum ", ChemAbbrev = "MnAl", ColorID = 6020 }, new Chemistry { ID = 9006, ChemComp = "Chromium, Iron, Zinc, Aluminum", ChemAbbrev = "CrFeZnAl", ColorID = 6126 }, new Chemistry { ID = 9007, ChemComp = "Chromium, Strontium", ChemAbbrev = "CrSn", ColorID = 6006 } }; foreach (Chemistry i in chemistry) { context.Chemistry.Add(i); } context.SaveChanges(); var colorfamily = new ColorFamily[] { new ColorFamily { ColorFamID = 1, ColorFam = "red", ColorName = "Rose Pink", ColorID = 6002 }, new ColorFamily { ColorFamID = 2, ColorFam = "orange", ColorName = "Saturn Orange", ColorID = 6121 }, new ColorFamily { ColorFamID = 3, ColorFam = "yellow", ColorName = "Vanadium", ColorID = 6404 }, new ColorFamily { ColorFamID = 2, ColorFam = "orange", ColorName = "Camel Beige", ColorID = 6166 }, new ColorFamily { ColorFamID = 1, ColorFam = "red", ColorName = "Alumina Pink", ColorID = 6020 }, new ColorFamily { ColorFamID = 2, ColorFam = "orange", ColorName = "Hazelnut", ColorID = 6126 }, new ColorFamily { ColorFamID = 1, ColorFam = "red", ColorName = "Deep Crimson", ColorID = 6006 } }; foreach (ColorFamily d in colorfamily) { context.ColorFamily.Add(d); } context.SaveChanges(); }