()
| 1185 | |
| 1186 | /// <inheritdoc /> |
| 1187 | public override void Draw() |
| 1188 | { |
| 1189 | // Update active state of input |
| 1190 | _input.IsActive = !_output.AllConnectionsDisabled; |
| 1191 | |
| 1192 | var style = Surface.Style; |
| 1193 | var connectionColor = style.Colors.Default; |
| 1194 | var type = ScriptType.Null; |
| 1195 | float barHorizontalOffset = -2; |
| 1196 | float barHeight = 3; |
| 1197 | |
| 1198 | if (_input.HasAnyConnection) |
| 1199 | { |
| 1200 | type = _input.Connections[0].CurrentType; |
| 1201 | var hints = _input.Connections[0].ParentNode.Archetype.ConnectionsHints; |
| 1202 | Surface.Style.GetConnectionColor(type, hints, out connectionColor); |
| 1203 | } |
| 1204 | |
| 1205 | // Draw the box as disabled if needed |
| 1206 | if (DrawDisabled) |
| 1207 | connectionColor = connectionColor * 0.6f; |
| 1208 | |
| 1209 | if (!_input.HasAnyConnection) |
| 1210 | Render2D.FillRectangle(new Rectangle(-barHorizontalOffset - barHeight * 2, (DefaultSize.Y - barHeight) / 2, barHeight * 2, barHeight), connectionColor); |
| 1211 | if (!_output.HasAnyConnection) |
| 1212 | Render2D.FillRectangle(new Rectangle(DefaultSize.X + barHorizontalOffset, (DefaultSize.Y - barHeight) / 2, barHeight * 2, barHeight), connectionColor); |
| 1213 | |
| 1214 | SpriteHandle icon; |
| 1215 | if (_input.HasAnyConnection && _output.HasAnyConnection) |
| 1216 | icon = type.IsVoid ? style.Icons.ArrowClose : style.Icons.BoxClose; |
| 1217 | else |
| 1218 | icon = type.IsVoid ? style.Icons.ArrowOpen : style.Icons.BoxOpen; |
| 1219 | |
| 1220 | // Shadow |
| 1221 | var shadowRect = _localBounds.MakeOffsetted(ShadowOffset); |
| 1222 | Render2D.DrawSprite(icon, shadowRect, Color.Black.AlphaMultiplied(0.125f)); |
| 1223 | |
| 1224 | Render2D.DrawSprite(icon, _localBounds, connectionColor); |
| 1225 | |
| 1226 | base.Draw(); |
| 1227 | } |
| 1228 | |
| 1229 | /// <inheritdoc /> |
| 1230 | public override bool OnMouseDown(Float2 location, MouseButton button) |
no test coverage detected