protected virtual void OnRenderCheck(UICheck control, CanvasRenderer renderer) { var borderColor = new ColorValue(0.5, 0.5, 0.5); var insideColor = new ColorValue(0, 0, 0); var checkColor = new ColorValue(1, 1, 0); var textColor = new ColorValue(1, 1, 1); switch (control.State) { //case UICheck.StateEnum.Hover: // checkColor = new ColorValue( 1, 1, 1 ); // break; case UICheck.StateEnum.Pushed: checkColor = new ColorValue(1, 1, 1); break; case UICheck.StateEnum.Disabled: checkColor = new ColorValue(0.7, 0.7, 0.7); textColor = new ColorValue(0.5, 0.5, 0.5); break; } var colorMultiplier = new ColorValue(1, 1, 1); //var colorMultiplier = control.GetTotalColorMultiplier(); //if( colorMultiplier.Alpha > 0 ) //{ control.GetScreenRectangle(out var rect); renderer.AddQuad(rect, borderColor * colorMultiplier); renderer.AddQuad(Multiply(rect, new Rectangle(0.1, 0.1, 0.9, 0.9)), insideColor * colorMultiplier); //Checked image if (control.Checked.Value == UICheck.CheckValue.Checked) { var points = new Vector2[] { new Vector2(290.04, 33.286), new Vector2(118.861, 204.427), new Vector2(52.32, 137.907), new Vector2(0, 190.226), new Vector2(118.861, 309.071), new Vector2(342.357, 85.606), }; var points2 = new Vector2[points.Length]; for (int n = 0; n < points2.Length; n++) { points2[n] = points[n] / new Vector2(342.357, 342.357); } var color2 = checkColor * colorMultiplier; var vertices = new CanvasRenderer.TriangleVertex[points2.Length]; for (int n = 0; n < points2.Length; n++) { vertices[n] = new CanvasRenderer.TriangleVertex(Multiply(rect, points2[n]).ToVector2F(), color2); } var indices = new int[] { 0, 1, 5, 5, 4, 1, 1, 2, 3, 3, 1, 4 }; renderer.AddTriangles(vertices, indices); } //Indeterminate image if (control.Checked.Value == UICheck.CheckValue.Indeterminate) { renderer.AddQuad(Multiply(rect, new Rectangle(0.3, 0.3, 0.7, 0.7)), checkColor * colorMultiplier); } //!!!!странно рисует чуть ниже, чем посередине //text renderer.AddText(" " + control.Text, new Vector2(rect.Right, rect.GetCenter().Y), EHorizontalAlignment.Left, EVerticalAlignment.Center, textColor * colorMultiplier); //renderer.AddText( " " + control.Text, new Vector2( rect.Right, rect.Top ), EHorizontalAlignment.Left, EVerticalAlignment.Top, textColor * colorMultiplier ); //} }
public void PerformCheckClick(UICheck control) { OnCheckClick(control); CheckClick?.Invoke(control); }
//////////////// protected virtual void OnCheckClick(UICheck control) { control.ParentContainer?.PlaySound(CheckSoundClick); }
public void PerformCheckMouseLeave(UICheck control) { OnCheckMouseLeave(control); CheckMouseLeave?.Invoke(control); }
//////////////// protected virtual void OnCheckMouseLeave(UICheck control) { control.ParentContainer?.PlaySound(CheckSoundMouseLeave); }
public void PerformCheckMouseEnter(UICheck control) { OnCheckMouseEnter(control); CheckMouseEnter?.Invoke(control); }