Bug info dialogue box now exists in-game, and offers the same functionality as the editor popup.

This commit is contained in:
Jamie Greunbaum 2024-06-06 15:11:55 -04:00
parent f73debc9b2
commit 524948c800
3 changed files with 99 additions and 1 deletions

View File

@ -377,7 +377,13 @@ func __place_marker(_position:Vector3, _normal:Vector3) -> void:
process_mode = Node.PROCESS_MODE_PAUSABLE process_mode = Node.PROCESS_MODE_PAUSABLE
func __pop_up_marker_info(_collider:BugInfoCollider, _position:Vector3, _normal:Vector3) -> void: func __pop_up_marker_info(_collider:BugInfoCollider, _position:Vector3, _normal:Vector3) -> void:
print(_collider.bug_info.title) var bug_info_dialogue : BugbotBugInfoDialogue = preload("res://addons/Bugbot/UI/bug_info.tscn").instantiate()
add_child(bug_info_dialogue)
bug_info_dialogue.bug_info = _collider.bug_info
process_mode = Node.PROCESS_MODE_PAUSABLE
bug_info_dialogue.tree_exited.connect(__on_bug_info_dialogue_closed)
func __on_bug_info_dialogue_closed() -> void:
process_mode = Node.PROCESS_MODE_ALWAYS
func __bug_report_form_data_prepared(tag_lists:Array) -> void: func __bug_report_form_data_prepared(tag_lists:Array) -> void:

33
UI/bug_info.gd Normal file
View File

@ -0,0 +1,33 @@
class_name BugbotBugInfoDialogue
extends Control
@onready var __bug_info_title_label : Label = $VBoxContainer/Title
@onready var __bug_info_severity_label : Label = $VBoxContainer/Severity
@onready var __bug_info_status_label : Label = $VBoxContainer/Status
var bug_info : BugbotBugData = null : set = __set_bug_info
var stored_mouse_mode : Input.MouseMode
func _enter_tree() -> void:
stored_mouse_mode = Input.mouse_mode
Input.mouse_mode = Input.MouseMode.MOUSE_MODE_VISIBLE
func _exit_tree() -> void:
Input.mouse_mode = stored_mouse_mode
func __set_bug_info(info:BugbotBugData) -> void:
bug_info = info
__bug_info_title_label.text = bug_info.title
__bug_info_severity_label.text = bug_info.severity
__bug_info_status_label.text = bug_info.status
func _on_open_in_browser_pressed() -> void:
OS.shell_open(BugbotServerAPI._create_new_server_api()._get_bug_url(bug_info))
queue_free()
func _on_close_pressed() -> void:
queue_free()

59
UI/bug_info.tscn Normal file
View File

@ -0,0 +1,59 @@
[gd_scene load_steps=3 format=3 uid="uid://bwm02lorpbpcy"]
[ext_resource type="Theme" uid="uid://cw07kl24clcs0" path="res://addons/Bugbot/UI/bug_report_form.theme" id="1_8fgi2"]
[ext_resource type="Script" path="res://addons/Bugbot/UI/bug_info.gd" id="2_6br02"]
[node name="BugInfo" type="ColorRect"]
process_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("1_8fgi2")
color = Color(0, 0, 0, 0.25)
script = ExtResource("2_6br02")
[node name="VBoxContainer" type="VBoxContainer" parent="."]
layout_mode = 1
anchors_preset = -1
anchor_left = 0.1
anchor_top = 0.7
anchor_right = 0.9
anchor_bottom = 0.9
grow_horizontal = 2
grow_vertical = 2
[node name="Title" type="Label" parent="VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
text = "Bug summary"
vertical_alignment = 2
[node name="Severity" type="Label" parent="VBoxContainer"]
layout_mode = 2
size_flags_vertical = 1
text = "Severity"
vertical_alignment = 2
[node name="Status" type="Label" parent="VBoxContainer"]
layout_mode = 2
size_flags_vertical = 1
text = "Open"
vertical_alignment = 2
[node name="Buttons" type="HBoxContainer" parent="VBoxContainer"]
layout_mode = 2
[node name="OpenInBrowser" type="Button" parent="VBoxContainer/Buttons"]
layout_mode = 2
size_flags_horizontal = 3
text = "Open In Browser"
[node name="Close" type="Button" parent="VBoxContainer/Buttons"]
layout_mode = 2
size_flags_horizontal = 3
text = "Close"
[connection signal="pressed" from="VBoxContainer/Buttons/OpenInBrowser" to="." method="_on_open_in_browser_pressed" flags=6]
[connection signal="pressed" from="VBoxContainer/Buttons/Close" to="." method="_on_close_pressed" flags=6]