2026-05-20 13:08:38 -04:00
|
|
|
@tool
|
2026-05-20 22:28:46 -04:00
|
|
|
extends PanelContainer
|
2026-05-20 12:54:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
@onready var grid: DashboardGrid = %DashboardGrid
|
|
|
|
|
|
2026-05-20 12:59:50 -04:00
|
|
|
var _modules: Array = []
|
|
|
|
|
|
2026-05-20 12:54:09 -04:00
|
|
|
|
|
|
|
|
func _ready() -> void:
|
2026-05-20 13:08:38 -04:00
|
|
|
_set_background()
|
2026-05-20 22:28:46 -04:00
|
|
|
if not Engine.is_editor_hint():
|
|
|
|
|
_add_modules()
|
2026-05-20 12:59:50 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
func _set_background() -> void:
|
2026-05-20 22:28:46 -04:00
|
|
|
var bg: StyleBoxFlat
|
|
|
|
|
if ConfigManager.has_method("get_color"):
|
|
|
|
|
bg = StyleBoxFlat.new()
|
|
|
|
|
bg.bg_color = ConfigManager.get_color("background_color", Color(0.08, 0.08, 0.12))
|
|
|
|
|
else:
|
|
|
|
|
bg = StyleBoxFlat.new()
|
|
|
|
|
bg.bg_color = Color(0.08, 0.08, 0.12)
|
2026-05-20 13:08:38 -04:00
|
|
|
add_theme_stylebox_override("panel", bg)
|
2026-05-20 12:59:50 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
func _add_modules() -> void:
|
2026-05-20 13:08:38 -04:00
|
|
|
var cpu := preload("res://panels/cpu/cpu_module.tscn").instantiate()
|
|
|
|
|
grid.place_module(cpu, 0, 0)
|
|
|
|
|
_modules.append(cpu)
|
2026-05-20 12:59:50 -04:00
|
|
|
|
2026-05-20 14:14:24 -04:00
|
|
|
var mem := preload("res://panels/memory/memory_module.tscn").instantiate()
|
|
|
|
|
grid.place_module(mem, 1, 0)
|
|
|
|
|
_modules.append(mem)
|
|
|
|
|
|
2026-05-20 15:41:26 -04:00
|
|
|
var test := preload("res://panels/testing/testing_module.tscn").instantiate()
|
|
|
|
|
grid.place_module(test, 2, 0)
|
|
|
|
|
_modules.append(test)
|
|
|
|
|
|
2026-05-20 13:08:38 -04:00
|
|
|
var timer := Timer.new()
|
|
|
|
|
timer.timeout.connect(_refresh_modules)
|
|
|
|
|
timer.autostart = true
|
|
|
|
|
timer.wait_time = 1.0
|
|
|
|
|
add_child(timer)
|
2026-05-20 12:59:50 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
func _refresh_modules() -> void:
|
2026-05-20 13:08:38 -04:00
|
|
|
var data: Dictionary = {}
|
|
|
|
|
for mod in _modules:
|
|
|
|
|
if is_instance_valid(mod) and mod.has_method("refresh"):
|
|
|
|
|
mod.refresh(data)
|