extends Button # 世界频道气泡发送按钮,线条风格与顶部 HUD 快捷入口保持一致。 const LINE_COLOR: Color = Color(0.592157, 0.72549, 0.835294, 0.88) const HOVER_COLOR: Color = Color(0.392157, 0.717647, 0.94902, 0.96) const LINE_WIDTH: float = 0.95 const DETAIL_WIDTH: float = 0.82 const BASE_SIZE: float = 27.0 var _iconScale: float = 1.0 var _iconOffset: Vector2 = Vector2.ZERO func _ready() -> void: text = "" queue_redraw() func _notification(what: int) -> void: if what == NOTIFICATION_THEME_CHANGED: queue_redraw() func _draw() -> void: _iconScale = min(size.x, size.y) / BASE_SIZE _iconOffset = (size - Vector2(BASE_SIZE, BASE_SIZE) * _iconScale) * 0.5 var lineColor := HOVER_COLOR if is_hovered() else LINE_COLOR _draw_round_rect(Rect2(6.0, 7.0, 15.0, 11.0), 3.2, lineColor, LINE_WIDTH) _draw_polyline([ Vector2(10.2, 18.0), Vector2(8.2, 21.2), Vector2(14.4, 18.0), ], lineColor, LINE_WIDTH) _draw_line(Vector2(9.2, 11.7), Vector2(17.6, 11.7), lineColor, DETAIL_WIDTH) _draw_line(Vector2(9.2, 14.6), Vector2(14.8, 14.6), lineColor, DETAIL_WIDTH) func _draw_round_rect(rect: Rect2, radius: float, color: Color, width: float) -> void: var left := rect.position.x var top := rect.position.y var right := rect.end.x var bottom := rect.end.y _draw_line(Vector2(left + radius, top), Vector2(right - radius, top), color, width) _draw_line(Vector2(right, top + radius), Vector2(right, bottom - radius), color, width) _draw_line(Vector2(right - radius, bottom), Vector2(left + radius, bottom), color, width) _draw_line(Vector2(left, bottom - radius), Vector2(left, top + radius), color, width) _draw_arc(Vector2(left + radius, top + radius), radius, PI, PI * 1.5, 8, color, width) _draw_arc(Vector2(right - radius, top + radius), radius, PI * 1.5, TAU, 8, color, width) _draw_arc(Vector2(right - radius, bottom - radius), radius, 0.0, PI * 0.5, 8, color, width) _draw_arc(Vector2(left + radius, bottom - radius), radius, PI * 0.5, PI, 8, color, width) func _draw_polyline(points: Array[Vector2], color: Color, width: float) -> void: var packed: PackedVector2Array = [] for point in points: packed.append(_p(point)) draw_polyline(packed, color, width, true) func _draw_line(from: Vector2, to: Vector2, color: Color, width: float) -> void: draw_line(_p(from), _p(to), color, width, true) func _draw_arc(center: Vector2, radius: float, startAngle: float, endAngle: float, pointCount: int, color: Color, width: float) -> void: draw_arc(_p(center), radius * _iconScale, startAngle, endAngle, pointCount, color, width, true) func _p(point: Vector2) -> Vector2: return _iconOffset + point * _iconScale