Begin UI refactor
This commit is contained in:
11
ui/RootUI.gd
Normal file
11
ui/RootUI.gd
Normal file
@@ -0,0 +1,11 @@
|
||||
class_name RootUI extends Control
|
||||
|
||||
@export var debugMenu:DebugMenu
|
||||
@export var textBox:VNTextbox
|
||||
|
||||
func _enter_tree() -> void:
|
||||
UI.rootUi = self
|
||||
|
||||
func _exit_tree() -> void:
|
||||
if UI.rootUi == self:
|
||||
UI.rootUi = null
|
||||
@@ -1,22 +1,22 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://baos0arpiskbp"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://bkx3l0kckf4a8" path="res://ui/component/VNTextbox.tscn" id="1_1mtk3"]
|
||||
[ext_resource type="Script" uid="uid://dq3qyyayugt5l" path="res://ui/UI.gd" id="1_son71"]
|
||||
[ext_resource type="Script" uid="uid://dq3qyyayugt5l" path="res://ui/RootUI.gd" id="1_son71"]
|
||||
[ext_resource type="PackedScene" uid="uid://c0i5e2dj11d8c" path="res://ui/pause/PauseMenu.tscn" id="2_atyu8"]
|
||||
[ext_resource type="PackedScene" uid="uid://b38dr0wkix76t" path="res://ui/debugmenu/DebugMenu.tscn" id="4_u132g"]
|
||||
|
||||
[node name="UI" type="Control" node_paths=PackedStringArray("TEXTBOX", "PAUSE", "DEBUG")]
|
||||
[node name="RootUI" type="Control" node_paths=PackedStringArray("debugMenu", "textBox")]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 1
|
||||
mouse_filter = 2
|
||||
script = ExtResource("1_son71")
|
||||
TEXTBOX = NodePath("VNTextbox")
|
||||
PAUSE = NodePath("PauseMenu")
|
||||
DEBUG = NodePath("DebugMenu")
|
||||
debugMenu = NodePath("DebugMenu")
|
||||
textBox = NodePath("VNTextbox")
|
||||
metadata/_custom_type_script = "uid://dq3qyyayugt5l"
|
||||
|
||||
[node name="DebugMenu" parent="." instance=ExtResource("4_u132g")]
|
||||
visible = false
|
||||
10
ui/UI.gd
10
ui/UI.gd
@@ -1,10 +0,0 @@
|
||||
class_name UISingleton extends Control
|
||||
|
||||
# @deprecated
|
||||
@export var TEXTBOX: VNTextbox
|
||||
|
||||
# @deprecated
|
||||
@export var PAUSE: PauseMenu
|
||||
|
||||
# @deprecated
|
||||
@export var DEBUG: DebugMenu
|
||||
15
ui/UISingleton.gd
Normal file
15
ui/UISingleton.gd
Normal file
@@ -0,0 +1,15 @@
|
||||
extends Node
|
||||
|
||||
var rootUi:RootUI = null
|
||||
|
||||
var DEBUG_MENU:
|
||||
get():
|
||||
if rootUi && rootUi.debugMenu:
|
||||
return rootUi.debugMenu
|
||||
return null
|
||||
|
||||
var TEXTBOX:
|
||||
get():
|
||||
if rootUi && rootUi.textBox:
|
||||
return rootUi.textBox
|
||||
return null
|
||||
1
ui/UISingleton.gd.uid
Normal file
1
ui/UISingleton.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://c0m8hvpqj3xcb
|
||||
@@ -20,7 +20,7 @@ func _enter_tree() -> void:
|
||||
btnBattle.pressed.connect(onBattlePressed)
|
||||
if btnCooking:
|
||||
btnCooking.pressed.connect(onCookingPressed)
|
||||
isClosed = false
|
||||
isClosed = true
|
||||
|
||||
func _exit_tree() -> void:
|
||||
if btnInitial:
|
||||
|
||||
@@ -9,6 +9,7 @@ anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
script = ExtResource("1_c1p3i")
|
||||
btnInitial = NodePath("HBoxContainer/InitialScene")
|
||||
btnOverworld = NodePath("HBoxContainer/OverworldScene")
|
||||
@@ -16,6 +17,16 @@ btnBattle = NodePath("HBoxContainer/BattleScene")
|
||||
btnCooking = NodePath("HBoxContainer/CookingScene")
|
||||
metadata/_custom_type_script = "uid://bekdew700opvq"
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="."]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
color = Color(1, 1, 1, 0.619608)
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
||||
layout_mode = 0
|
||||
offset_right = 40.0
|
||||
|
||||
Reference in New Issue
Block a user