public static GetColorQueryRequest New(ColorId colorId) { return(new GetColorQueryRequest { ColorId = colorId }); }
public Colorbase(Color colorPlayer, Color colorBlock, Color colorWheel, ColorId colorId) { this.colorPlayer = colorPlayer; this.colorBlock = colorBlock; this.colorWheel = colorWheel; this.colorId = colorId; }
public void Should_Create_ColorId_Whithout_Id() { var colorId = ColorId.New(); Assert.True(Guid.TryParse(colorId.Value.ToString(), out var _)); Assert.NotEqual(Guid.Empty, colorId.Value); }
/// <summary> /// This constructor contains all fields of Measure <see cref="Measure"/>. /// </summary> /// <param name="id">Id of measure.</param> /// <param name="name">Name of measure.</param> /// <param name="status">Status of register.</param> /// <param name="creationDate">Date of create.</param> /// <param name="updateDate">Date of Update.</param> /// <param name="measureId">Measure Id.</param> /// <param name="stock">Quantity in stock.</param> /// <param name="colorId">Id of color.</param> /// <param name="tenantId">Cliente Id.</param> /// <returns>Returns new instance of Measure <see cref="Feedstock"/></returns> public static Feedstock New( FeedstockId feedstockId, string name, Status status, DateTime creationDate, DateTime?updateDate, MeasureId measureId, int stock, ColorId colorId, TenantId tenantId) { //Ensure.That(feedstockId, ResourcesReader.Field(nameof(feedstockId))).ArgumentIsNotNull(); //Ensure.That(colorId, ResourcesReader.Field(nameof(colorId))).ArgumentIsNotNull(); //Ensure.That(tenantId, ResourcesReader.Field(nameof(tenantId))).ArgumentIsNotNull(); //Ensure.That(measureId, ResourcesReader.Field(nameof(measureId))).ArgumentIsNotNull(); var feedstock = new Feedstock { FeedstockId = feedstockId, Name = name, Status = status, CreationDate = creationDate, UpdateDate = updateDate, MeasureId = measureId, Stock = stock, ColorId = colorId, TenantId = tenantId }; feedstock.Isvalid(); return(feedstock); }
public void ReSelect(int i, ColorId type) { if (i < textBlocks.Count) { (textBlocks[i].Parent as Border).BorderBrush = brushes[(int)type]; } }
void ParseColorSpawningOrder(JSONNode data) { if (!data.HasKey(COLOR_SPAWNING_ORDER)) { return; } var items = data.GetCollection(COLOR_SPAWNING_ORDER); if (items.Count > 0) { colorSpawningOrder.Clear(); try { foreach (var item in items) { ColorId colorId = LevelEditorUtils.ParseEnum <ColorId>(item.AsString().UppercaseFirst()); colorSpawningOrder.Add(colorId); } } catch (Exception ex) { colorSpawningOrder.Clear(); Debug.LogError("LEVEL : Failed to parse colorSpawningOrder" + ex.Message); } } }
private SendColorIdReturn RespondToSendColorId(ColorId idReceived, ICommandCallerInfo callerInfo) { respondingColors.Add(idReceived.colorId); return(SendColorIdReturn.Create()); }
/// <summary> /// This constructor contains some fields of Measure <see cref="Feedstock"/>. /// </summary> /// <param name="name">Name of measure.</param> /// <param name="status">Status of register.</param> /// <param name="measureId">Measure Id.</param> /// <param name="stock">Quantity in stock.</param> /// <param name="colorId">Id of color.</param> /// <param name="tenantId">Cliente Id.</param> /// <returns>Returns new instance of Measure <see cref="Feedstock"/></returns> public static Feedstock New( string name, Status status, MeasureId measureId, int stock, ColorId colorId, TenantId tenantId) { var feedstock = new Feedstock { Name = name, Status = status, CreationDate = DateTime.Now, UpdateDate = null, MeasureId = measureId, Stock = stock, ColorId = colorId, TenantId = tenantId, FeedstockId = FeedstockId.New() }; feedstock.Isvalid(); return(feedstock); }
public void SetNewColor(ColorId newColorId) { objectColor = colorScheme.GetObjectColorsById(new ColorId[1] { newColorId })[0]; Colorize(); }
public async Task Should_Delete_Color() { var colorid = ColorId.New(); await _colorRepository.DeleteAsync(colorid); Assert.True(_delete); }
public void SetSpriteColor(int newId) { id = newId; if (sprite != null) { sprite.color = ColorId.GetColor(newId); } }
public void Select(TextBlock textBlock, ColorId colorId) { var border = textBlock.Parent as Border; border.BorderBrush = brushes[(int)colorId]; border.BorderThickness = new Thickness(1); textBlocks.Add(textBlock); }
public async Task Should_Get_Color() { var getColorQueryHandler = new GetColorQueryHandler(_colorRepository); var request = GetColorQueryRequest.New(ColorId.New()); var colorDto = await getColorQueryHandler.Handle(request, new CancellationToken()); Assert.NotNull(colorDto); }
protected override void AddDescriptions() { base.AddDescriptions(); AddDescription(nameof(Name), Name.ToStr()); AddDescription(nameof(CategoryId), CategoryId.ToStr()); AddDescription(nameof(ColorId), ColorId.ToStr()); AddDescription(nameof(Price), Price.ToStr()); AddDescription(nameof(ProductionDate), ProductionDate.ToStr()); }
protected virtual void CheckWay(int x, int y, int directionX, int directionY, ColorId myColor, Block[,] gridArray, ref List <Block> validBlocks, LineOrientation orientation) { validBlocks.Clear(); validBlocks.Add(gridArray[x, y]); Check(x, y, directionX, directionY, myColor, gridArray, ref validBlocks); Check(x, y, -directionX, -directionY, myColor, gridArray, ref validBlocks); CheckValid(validBlocks, orientation); }
public ColorTest() { _colorName = "blue"; _status = StatusEnum.Enable; _tenantId = TenantId.New(); _colorId = ColorId.New(); _creationDate = DateTime.Now; _updateDate = DateTime.Now.AddHours(1); _color = Color.New(_colorName, _status, _tenantId); }
static public String toString( ColorId id ) { switch( id ) { case ColorId.Red: return "紅"; case ColorId.White: return "白"; case ColorId.Yellow: return "黃"; case ColorId.Green: return "綠"; } return "Error Color"; }
public Color GetColorById(ColorId id) { foreach (BlockColor blockColor in PossibleColors) { if (blockColor.ColorId == id) { return(blockColor.Color); } } return(default);
public FeedstockTest() { _feedstockName = "leather"; _status = StatusEnum.Enable; _measureId = MeasureId.New(); _tenantId = TenantId.New(); _colorId = ColorId.New(); _stock = 10; _feedstockId = FeedstockId.New(); _creationDate = DateTime.Now; _updateDate = DateTime.Now.AddHours(1); _feedstock = Domain.Entities.Feedstock.New(_feedstockName, _status, _measureId, _stock, _colorId, _tenantId); }
protected virtual void Check(int x, int y, int directionX, int directionY, ColorId myColor, Block[,] gridArray, ref List <Block> validBlocks) { int newX = x + directionX; int newY = y + directionY; if (newX >= 0 && newX < sceneData.Width && newY >= 0 && newY < sceneData.Height && gridArray[newX, newY] != null && !gridArray[newX, newY].IsLock) { if (gridArray[newX, newY].BlockColor.ColorId == myColor) { validBlocks.Add(gridArray[newX, newY]); Check(newX, newY, directionX, directionY, myColor, gridArray, ref validBlocks); } } }
public void AddLine(Point p0, Point p1, ColorId colorId) { var line = new Line(); line.X1 = p0.X; line.Y1 = p0.Y; line.X2 = p1.X; line.Y2 = p1.Y; line.Stroke = brushes[(int)colorId]; line.StrokeThickness = 1; lines.Add(line); canvas.Children.Add(line); }
public void AddAvailableColor(ColorId newColor) { if (availableColorsId.Contains(newColor)) { return; } availableColorsId.Add(newColor); foreach (var colorbase in allColors) { if (colorbase.colorId == newColor) { availableColors.Add(colorbase); } } }
private SendAndUpdateColorIdReturn RespondToSendAndUpdateColorId(ColorId idReceived, ICommandCallerInfo callerInfo) { respondingColors.Add(idReceived.colorId); if (!CheckOutColorWriter.Data.colorsIds.Contains(idReceived.colorId)) { CheckOutColorWriter.Data.colorsIds.Add(idReceived.colorId); CheckOutColorWriter.Data.colorsIds.Sort(); var update = new Improbable.Demo.CheckOutColor.Update(); update.colorsIds = CheckOutColorWriter.Data.colorsIds; CheckOutColorWriter.Send(update); } return(SendAndUpdateColorIdReturn.Create()); }
protected virtual void CheckNeighbors(int x, int y, Block[,] gridArray) { List <Block> validBlocks = new List <Block>(); ColorId myColor = gridArray[x, y].BlockColor.ColorId; for (int i = 0; i < lines.Count; i++) { if (lines[i].BlocksInLine.Contains(gridArray[x, y])) { return; } } CheckWay(x, y, 0, 1, myColor, gridArray, ref validBlocks, LineOrientation.straight); CheckWay(x, y, 1, 0, myColor, gridArray, ref validBlocks, LineOrientation.straight); CheckWay(x, y, 1, 1, myColor, gridArray, ref validBlocks, LineOrientation.sloping); CheckWay(x, y, -1, 1, myColor, gridArray, ref validBlocks, LineOrientation.sloping); }
/// <summary> /// This constructor contains some fields of Color <see cref="Color"/>. /// </summary> /// <param name="name">Name of color.</param> /// <param name="status">Status of register.</param> /// <returns>Returns new instance of Color <see cref="Color"/></returns> public static Color New( string name, Status status, TenantId tenantId) { var color = new Color { ColorId = ColorId.New(), Name = name, Status = status, CreationDate = DateTime.Now, TenantId = tenantId }; color.Isvalid(); return(color); }
/// <summary> /// This constructor contains all fields of Color <see cref="Color"/>. /// </summary> /// <param name="id">Id of color.</param> /// <param name="name">Name of color.</param> /// <param name="status">Status of register.</param> /// <param name="creationDate">Date of create.</param> /// <param name="updateDate">Date of Update.</param> /// <param name="tenantId">Cliente Id.</param> /// <returns>Returns new instance of Color <see cref="Color"/></returns> public static Color New( ColorId colorId, string name, Status status, DateTime creationDate, DateTime?updateDate, TenantId tenantId) { var color = new Color { ColorId = colorId, Name = name, Status = status, CreationDate = creationDate, UpdateDate = updateDate, TenantId = tenantId }; color.Isvalid(); return(color); }
public void Should_Not_Create_ColorId_When_Id_Is_Empty() { Assert.Throws <Exception>(() => ColorId.New(Guid.Empty)); }
void ParseConditions(JSONObject conditions) { typeWinningConditions.Clear(); colorWinningConditions.Clear(); skillWinningConditions.Clear(); var keys = conditions.Keys; foreach (string key in keys) { if (key == SCORE) { minScoreWinningCondition = (int)conditions[key]; } else if (key == MOVESOVER) { movesOver = (int)conditions[key] > 0?true:false; } else { if (LevelEditorInfo.Instance.levelSettingConfig.ObjectiveCollection.Contains(key)) { int amount = (int)conditions[key]; typeWinningConditions.Add(key, amount); } else { try { string[] colorsStrings = key.Split(','); var colorIds = new List <ColorId>(); foreach (string colorString in colorsStrings) { ColorId colorId = LevelEditorUtils.ParseEnum <ColorId>(colorString.UppercaseFirst()); colorIds.Add(colorId); } int amount = (int)conditions[key]; var colorWinningCondition = new ColorWinningCondition(); colorWinningCondition.amount = amount; colorWinningCondition.colors = colorIds; colorWinningConditions.Add(colorWinningCondition); } catch { try { CompanionTypeId skillType = LevelEditorUtils.ParseEnum <CompanionTypeId>(key); int amount = (int)conditions[key]; skillWinningConditions.Add(skillType, amount); } catch { Debug.LogWarning("Could not parse winning condition for key = " + key + ", levelNum = " + levelNum); } } } } } }
void addObject( ObjectId id , int num , ColorId color ) { ObjectInfo info; info.id = id; info.num = num; info.color = ColorId.White; objects.Add(info); }
public static Entities.Feedstock Map(FeedstockCommandDto feedstockInsertDto) { return(Entities.Feedstock.New(feedstockInsertDto.Name, feedstockInsertDto.Status, MeasureId.New(feedstockInsertDto.MeasureId), feedstockInsertDto.Stock, ColorId.New(feedstockInsertDto.ColorId), TenantId.New(feedstockInsertDto.TenantId))); }
private void addObjectImageForm(WWWForm form, BaseFPSAgentController agent, ref MetadataWrapper metadata) { if (this.renderObjectImage) { if (!agent.imageSynthesis.hasCapturePass("_id")) { Debug.LogError("Object Image not available in imagesynthesis - returning empty image"); } byte[] bytes = agent.imageSynthesis.Encode("_id"); form.AddBinaryData("image_ids", bytes); Color[] id_image = agent.imageSynthesis.tex.GetPixels(); Dictionary <Color, int[]> colorBounds = new Dictionary <Color, int[]> (); for (int yy = 0; yy < tex.height; yy++) { for (int xx = 0; xx < tex.width; xx++) { Color colorOn = id_image [yy * tex.width + xx]; if (!colorBounds.ContainsKey(colorOn)) { colorBounds [colorOn] = new int[] { xx, yy, xx, yy }; } else { int[] oldPoint = colorBounds [colorOn]; if (xx < oldPoint [0]) { oldPoint [0] = xx; } if (yy < oldPoint [1]) { oldPoint [1] = yy; } if (xx > oldPoint [2]) { oldPoint [2] = xx; } if (yy > oldPoint [3]) { oldPoint [3] = yy; } } } } List <ColorBounds> boundsList = new List <ColorBounds> (); foreach (Color key in colorBounds.Keys) { ColorBounds bounds = new ColorBounds(); bounds.color = new ushort[] { (ushort)Math.Round(key.r * 255), (ushort)Math.Round(key.g * 255), (ushort)Math.Round(key.b * 255) }; bounds.bounds = colorBounds [key]; boundsList.Add(bounds); } metadata.colorBounds = boundsList.ToArray(); List <ColorId> colors = new List <ColorId> (); foreach (Color key in agent.imageSynthesis.colorIds.Keys) { ColorId cid = new ColorId(); cid.color = new ushort[] { (ushort)Math.Round(key.r * 255), (ushort)Math.Round(key.g * 255), (ushort)Math.Round(key.b * 255) }; cid.name = agent.imageSynthesis.colorIds [key]; colors.Add(cid); } metadata.colors = colors.ToArray(); } }
public async Task DeleteAsync(ColorId colorId) { var color = await GetAsync(colorId); _repository.Delete(color); }