Moving files pre-refactor
This commit is contained in:
44
ui/component/AdvancedRichText.gd
Normal file
44
ui/component/AdvancedRichText.gd
Normal file
@@ -0,0 +1,44 @@
|
||||
@tool
|
||||
class_name AdvancedRichText extends RichTextLabel
|
||||
|
||||
@export_multiline var advancedText:String = "":
|
||||
get():
|
||||
return advancedText
|
||||
set(value):
|
||||
advancedText = value
|
||||
_parseAdvancedText()
|
||||
|
||||
@export var translate:bool = true:
|
||||
set(value):
|
||||
translate = value
|
||||
_parseAdvancedText()
|
||||
get():
|
||||
return translate
|
||||
|
||||
func _init() -> void:
|
||||
self._parseAdvancedText()
|
||||
|
||||
func _enter_tree() -> void:
|
||||
self._parseAdvancedText()
|
||||
|
||||
func _parseAdvancedText() -> void:
|
||||
if advancedText.is_empty():
|
||||
self.text = ""
|
||||
return
|
||||
var key = advancedText
|
||||
if self.translate:
|
||||
key = tr(key)
|
||||
self.text = processInputTags(key)
|
||||
|
||||
func processInputTags(text:String) -> String:
|
||||
var regex = RegEx.new()
|
||||
regex.compile(r"\[input action=(.*?)\](.*?)\[/input\]")
|
||||
var result = text
|
||||
for match in regex.search_all(text):
|
||||
var action = match.get_string(1).to_lower()
|
||||
var height:int = 32
|
||||
# var device = get_current_device_type()
|
||||
# var icon_path = get_icon_for_action(action, device)
|
||||
var img_tag = "[img height=%d valign=center,center]res://textures/input/%s.tres[/img]" % [ height, action ]
|
||||
result = result.replace(match.get_string(0), img_tag)
|
||||
return result
|
1
ui/component/AdvancedRichText.gd.uid
Normal file
1
ui/component/AdvancedRichText.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bjj6upgk1uvxd
|
34
ui/component/ClosableMenu.gd
Normal file
34
ui/component/ClosableMenu.gd
Normal file
@@ -0,0 +1,34 @@
|
||||
class_name ClosableMenu extends Control
|
||||
|
||||
@export var isOpen: bool:
|
||||
set(newValue):
|
||||
isOpen = newValue
|
||||
visible = newValue
|
||||
if newValue:
|
||||
opened.emit()
|
||||
else:
|
||||
closed.emit()
|
||||
get():
|
||||
return isOpen
|
||||
|
||||
signal closed
|
||||
signal opened
|
||||
|
||||
func _enter_tree() -> void:
|
||||
visible = isOpen
|
||||
|
||||
func _exit_tree() -> void:
|
||||
visible = false
|
||||
|
||||
func _ready() -> void:
|
||||
visible = isOpen
|
||||
print("ClosableMenu is ready, isOpen: ", isOpen)
|
||||
|
||||
func close() -> void:
|
||||
isOpen = false
|
||||
|
||||
func open() -> void:
|
||||
isOpen = true
|
||||
|
||||
func toggle() -> void:
|
||||
isOpen = !isOpen
|
1
ui/component/ClosableMenu.gd.uid
Normal file
1
ui/component/ClosableMenu.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bcjfv6dw0ugvo
|
123
ui/component/VNTextbox.gd
Normal file
123
ui/component/VNTextbox.gd
Normal file
@@ -0,0 +1,123 @@
|
||||
class_name VNTextbox extends PanelContainer
|
||||
|
||||
const VN_REVEAL_TIME = 0.01
|
||||
const VISIBLE_LINES:int = 4
|
||||
|
||||
var label:RichTextLabel;
|
||||
var text:String = ""
|
||||
var parsedOutText = ""
|
||||
var visibleCharacters:int = 0;
|
||||
var revealTimer:float = 0;
|
||||
|
||||
var lineStarts:Array[int] = [];
|
||||
var newlineIndexes:Array[int] = [];
|
||||
var wrappedText:String = "";
|
||||
var currentLine = 0;
|
||||
var currentViewScrolled = true;
|
||||
var isSpeedupDown = false;
|
||||
var isMoreViews = false;
|
||||
var isClosed = true;
|
||||
|
||||
signal textboxClosing
|
||||
|
||||
func _ready() -> void:
|
||||
label = $MarginContainer/Label
|
||||
self.visible = false;
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if text == "":
|
||||
isClosed = true;
|
||||
return;
|
||||
|
||||
if currentViewScrolled:
|
||||
if Input.is_action_just_pressed("interact"):
|
||||
if isMoreViews:
|
||||
visibleCharacters = 0;
|
||||
currentLine += VISIBLE_LINES;
|
||||
currentViewScrolled = false;
|
||||
recalculateWrapping();
|
||||
return
|
||||
setText("");
|
||||
textboxClosing.emit();
|
||||
return;
|
||||
|
||||
if visibleCharacters >= getCountOfCharactersToScrollInView():
|
||||
currentViewScrolled = true;
|
||||
#print("Scrolled view");
|
||||
#if isMoreViews:
|
||||
#print("More views");
|
||||
return;
|
||||
|
||||
if Input.is_action_just_pressed("interact"):
|
||||
isSpeedupDown = true;
|
||||
elif Input.is_action_just_released("interact"):
|
||||
isSpeedupDown = false;
|
||||
elif !Input.is_action_pressed("interact"):
|
||||
isSpeedupDown = false;
|
||||
|
||||
revealTimer += delta;
|
||||
if isSpeedupDown:
|
||||
revealTimer += delta;
|
||||
|
||||
if revealTimer > VN_REVEAL_TIME:
|
||||
revealTimer = 0;
|
||||
visibleCharacters += 1;
|
||||
label.visible_characters = visibleCharacters;
|
||||
|
||||
func getCountOfCharactersToScrollInView() -> int:
|
||||
if lineStarts.size() <= VISIBLE_LINES:
|
||||
return wrappedText.length();
|
||||
if currentLine + VISIBLE_LINES >= lineStarts.size():
|
||||
return wrappedText.length() - lineStarts[currentLine];
|
||||
return lineStarts[min(lineStarts.size(), currentLine + VISIBLE_LINES)] - lineStarts[currentLine];
|
||||
|
||||
func recalculateWrapping():
|
||||
# Reset label to default.
|
||||
label.advancedText = text;
|
||||
label.visible_characters = -1;
|
||||
label.fit_content = true;
|
||||
isMoreViews = false;
|
||||
|
||||
# Determine where the wrapped newlines are
|
||||
lineStarts = [ 0 ];
|
||||
var line = 0;
|
||||
var wasNewLine = false;
|
||||
for i in range(0, text.length()):
|
||||
var tLine = label.get_character_line(i);
|
||||
if tLine == line:
|
||||
wasNewLine = false
|
||||
if text[i] == "\n":
|
||||
wasNewLine = true
|
||||
continue;
|
||||
if !wasNewLine:
|
||||
newlineIndexes.append(i);
|
||||
lineStarts.append(i);
|
||||
line = tLine;
|
||||
|
||||
# Create fake pre-wrapped text.
|
||||
wrappedText = "";
|
||||
for i in range(lineStarts[currentLine], text.length()):
|
||||
if newlineIndexes.find(i) != -1 and i != lineStarts[currentLine]:
|
||||
wrappedText += "\n";
|
||||
wrappedText += text[i];
|
||||
|
||||
label.advancedText = wrappedText;
|
||||
label.fit_content = false;
|
||||
label.visible_characters = 0;
|
||||
|
||||
if lineStarts.size() > currentLine + VISIBLE_LINES:
|
||||
isMoreViews = true;
|
||||
|
||||
func setText(text:String) -> void:
|
||||
self.text = text;
|
||||
if text == "":
|
||||
self.visible = false;
|
||||
return;
|
||||
|
||||
isClosed = false;
|
||||
revealTimer = 0;
|
||||
visibleCharacters = 0;
|
||||
currentLine = 0;
|
||||
currentViewScrolled = false;
|
||||
recalculateWrapping();
|
||||
self.visible = true;
|
1
ui/component/VNTextbox.gd.uid
Normal file
1
ui/component/VNTextbox.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://h8lw23ypcfty
|
38
ui/component/VNTextbox.tscn
Normal file
38
ui/component/VNTextbox.tscn
Normal file
@@ -0,0 +1,38 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://bkx3l0kckf4a8"]
|
||||
|
||||
[ext_resource type="Theme" uid="uid://dm7ee4aqjr2dl" path="res://ui/UI Theme.tres" id="1_wx4lp"]
|
||||
[ext_resource type="Script" uid="uid://h8lw23ypcfty" path="res://ui/component/VNTextbox.gd" id="2_uo1gm"]
|
||||
[ext_resource type="Script" uid="uid://bjj6upgk1uvxd" path="res://ui/component/AdvancedRichText.gd" id="3_m60k3"]
|
||||
|
||||
[node name="VNTextbox" type="PanelContainer"]
|
||||
anchors_preset = 12
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_top = -58.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 0
|
||||
theme = ExtResource("1_wx4lp")
|
||||
script = ExtResource("2_uo1gm")
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("1_wx4lp")
|
||||
theme_override_constants/margin_left = 4
|
||||
theme_override_constants/margin_top = 4
|
||||
theme_override_constants/margin_right = 4
|
||||
theme_override_constants/margin_bottom = 4
|
||||
|
||||
[node name="Label" type="RichTextLabel" parent="MarginContainer"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("1_wx4lp")
|
||||
bbcode_enabled = true
|
||||
text = "TEST
|
||||
TEST
|
||||
TEST
|
||||
TEST"
|
||||
script = ExtResource("3_m60k3")
|
||||
advancedText = "TEST
|
||||
TEST
|
||||
TEST
|
||||
TEST"
|
12
ui/input/debug.tres
Normal file
12
ui/input/debug.tres
Normal file
@@ -0,0 +1,12 @@
|
||||
[gd_resource type="Texture2D" script_class="ControllerIconTexture" load_steps=2 format=3 uid="uid://vb20551utmet"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://ddxpo5u73ssi2" path="res://addons/controller_icons/objects/ControllerIconTexture.gd" id="1_iw3l5"]
|
||||
|
||||
[resource]
|
||||
resource_local_to_scene = false
|
||||
resource_name = ""
|
||||
script = ExtResource("1_iw3l5")
|
||||
path = "debug"
|
||||
show_mode = 0
|
||||
force_type = 0
|
||||
metadata/_custom_type_script = "uid://ddxpo5u73ssi2"
|
12
ui/input/down.tres
Normal file
12
ui/input/down.tres
Normal file
@@ -0,0 +1,12 @@
|
||||
[gd_resource type="Texture2D" script_class="ControllerIconTexture" load_steps=2 format=3 uid="uid://cyfh2wyhh1cjg"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://ddxpo5u73ssi2" path="res://addons/controller_icons/objects/ControllerIconTexture.gd" id="1_p6b3a"]
|
||||
|
||||
[resource]
|
||||
resource_local_to_scene = false
|
||||
resource_name = ""
|
||||
script = ExtResource("1_p6b3a")
|
||||
path = "down"
|
||||
show_mode = 0
|
||||
force_type = 0
|
||||
metadata/_custom_type_script = "uid://ddxpo5u73ssi2"
|
12
ui/input/interact.tres
Normal file
12
ui/input/interact.tres
Normal file
@@ -0,0 +1,12 @@
|
||||
[gd_resource type="Texture2D" script_class="ControllerIconTexture" load_steps=2 format=3 uid="uid://b3ii1cu3mc7jc"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://ddxpo5u73ssi2" path="res://addons/controller_icons/objects/ControllerIconTexture.gd" id="1_ngf5d"]
|
||||
|
||||
[resource]
|
||||
resource_local_to_scene = false
|
||||
resource_name = ""
|
||||
script = ExtResource("1_ngf5d")
|
||||
path = "up"
|
||||
show_mode = 0
|
||||
force_type = 0
|
||||
metadata/_custom_type_script = "uid://ddxpo5u73ssi2"
|
12
ui/input/left.tres
Normal file
12
ui/input/left.tres
Normal file
@@ -0,0 +1,12 @@
|
||||
[gd_resource type="Texture2D" script_class="ControllerIconTexture" load_steps=2 format=3 uid="uid://thb0gnik8oo3"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://ddxpo5u73ssi2" path="res://addons/controller_icons/objects/ControllerIconTexture.gd" id="1_fijpq"]
|
||||
|
||||
[resource]
|
||||
resource_local_to_scene = false
|
||||
resource_name = ""
|
||||
script = ExtResource("1_fijpq")
|
||||
path = "left"
|
||||
show_mode = 0
|
||||
force_type = 0
|
||||
metadata/_custom_type_script = "uid://ddxpo5u73ssi2"
|
12
ui/input/pause.tres
Normal file
12
ui/input/pause.tres
Normal file
@@ -0,0 +1,12 @@
|
||||
[gd_resource type="Texture2D" script_class="ControllerIconTexture" load_steps=2 format=3 uid="uid://byijoyarhygot"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://ddxpo5u73ssi2" path="res://addons/controller_icons/objects/ControllerIconTexture.gd" id="1_o0qtj"]
|
||||
|
||||
[resource]
|
||||
resource_local_to_scene = false
|
||||
resource_name = ""
|
||||
script = ExtResource("1_o0qtj")
|
||||
path = "pause"
|
||||
show_mode = 0
|
||||
force_type = 0
|
||||
metadata/_custom_type_script = "uid://ddxpo5u73ssi2"
|
12
ui/input/right.tres
Normal file
12
ui/input/right.tres
Normal file
@@ -0,0 +1,12 @@
|
||||
[gd_resource type="Texture2D" script_class="ControllerIconTexture" load_steps=2 format=3 uid="uid://dajlk4u1q8rsp"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://ddxpo5u73ssi2" path="res://addons/controller_icons/objects/ControllerIconTexture.gd" id="1_guxqd"]
|
||||
|
||||
[resource]
|
||||
resource_local_to_scene = false
|
||||
resource_name = ""
|
||||
script = ExtResource("1_guxqd")
|
||||
path = "right"
|
||||
show_mode = 0
|
||||
force_type = 0
|
||||
metadata/_custom_type_script = "uid://ddxpo5u73ssi2"
|
12
ui/input/up.tres
Normal file
12
ui/input/up.tres
Normal file
@@ -0,0 +1,12 @@
|
||||
[gd_resource type="Texture2D" script_class="ControllerIconTexture" load_steps=2 format=3 uid="uid://blut4glc4n0ck"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://ddxpo5u73ssi2" path="res://addons/controller_icons/objects/ControllerIconTexture.gd" id="1_y6k0e"]
|
||||
|
||||
[resource]
|
||||
resource_local_to_scene = false
|
||||
resource_name = ""
|
||||
script = ExtResource("1_y6k0e")
|
||||
path = "left"
|
||||
show_mode = 0
|
||||
force_type = 0
|
||||
metadata/_custom_type_script = "uid://ddxpo5u73ssi2"
|
16
ui/mainmenu/MainMenu.gd
Normal file
16
ui/mainmenu/MainMenu.gd
Normal file
@@ -0,0 +1,16 @@
|
||||
class_name MainMenu extends Control
|
||||
|
||||
@export var btnNewGame:Button
|
||||
@export var btnSettings:Button
|
||||
@export var settingsMenu:ClosableMenu
|
||||
|
||||
func _ready() -> void:
|
||||
btnNewGame.pressed.connect(onNewGamePressed)
|
||||
btnSettings.pressed.connect(onSettingsPressed)
|
||||
|
||||
func onNewGamePressed() -> void:
|
||||
SCENE.setScene(SceneSingleton.SceneType.OVERWORLD)
|
||||
|
||||
func onSettingsPressed() -> void:
|
||||
print("Settings button pressed")
|
||||
settingsMenu.isOpen = true
|
1
ui/mainmenu/MainMenu.gd.uid
Normal file
1
ui/mainmenu/MainMenu.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://btfeuku41py2b
|
79
ui/mainmenu/MainMenu.tscn
Normal file
79
ui/mainmenu/MainMenu.tscn
Normal file
@@ -0,0 +1,79 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://d2u7xxqmy8mws"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://btfeuku41py2b" path="res://ui/mainmenu/MainMenu.gd" id="1_vp3lc"]
|
||||
[ext_resource type="Script" uid="uid://bcjfv6dw0ugvo" path="res://ui/component/ClosableMenu.gd" id="2_f3vro"]
|
||||
[ext_resource type="PackedScene" uid="uid://d3f31lli1ahts" path="res://ui/settings/SettingsMenu.tscn" id="3_44i87"]
|
||||
|
||||
[node name="Main Menu" type="Control" node_paths=PackedStringArray("btnNewGame", "btnSettings", "settingsMenu")]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_vp3lc")
|
||||
btnNewGame = NodePath("VBoxContainer/NewGame")
|
||||
btnSettings = NodePath("VBoxContainer/Settings")
|
||||
settingsMenu = NodePath("MainMenuSettings")
|
||||
metadata/_custom_type_script = "uid://btfeuku41py2b"
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
layout_mode = 0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Main Menu"
|
||||
|
||||
[node name="NewGame" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "New Game"
|
||||
|
||||
[node name="Settings" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Settings"
|
||||
|
||||
[node name="MainMenuSettings" type="Control" parent="."]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("2_f3vro")
|
||||
|
||||
[node name="Panel" type="Panel" parent="MainMenuSettings"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MainMenuSettings/Panel"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="MainMenuSettings/Panel/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="MainMenuSettings/Panel/VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Settings"
|
||||
|
||||
[node name="CloseBtn" type="Button" parent="MainMenuSettings/Panel/VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Close"
|
||||
|
||||
[node name="SettingsMenu" parent="MainMenuSettings/Panel/VBoxContainer" instance=ExtResource("3_44i87")]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
|
||||
[connection signal="pressed" from="MainMenuSettings/Panel/VBoxContainer/HBoxContainer/CloseBtn" to="MainMenuSettings" method="close"]
|
18
ui/pause/PauseMain.gd
Normal file
18
ui/pause/PauseMain.gd
Normal file
@@ -0,0 +1,18 @@
|
||||
class_name PauseMain extends VBoxContainer
|
||||
|
||||
func _ready() -> void:
|
||||
visible = false
|
||||
$HBoxContainer/ItemList.item_selected.connect(onItemSelected)
|
||||
|
||||
func open():
|
||||
visible = true
|
||||
$HBoxContainer/ItemList.clear()
|
||||
|
||||
func close():
|
||||
visible = false
|
||||
|
||||
func isOpen() -> bool:
|
||||
return visible
|
||||
|
||||
func onItemSelected(index:int) -> void:
|
||||
print("Selected item index: ", index)
|
1
ui/pause/PauseMain.gd.uid
Normal file
1
ui/pause/PauseMain.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://c7kvg0jw6w340
|
52
ui/pause/PauseMain.tscn
Normal file
52
ui/pause/PauseMain.tscn
Normal file
@@ -0,0 +1,52 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://bt0okj2rie8qf"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://c7kvg0jw6w340" path="res://ui/pause/PauseMain.gd" id="1_b5xfl"]
|
||||
|
||||
[node name="PauseMain" type="VBoxContainer"]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_b5xfl")
|
||||
metadata/_custom_type_script = "uid://c7kvg0jw6w340"
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="PanelContainer" type="PanelContainer" parent="HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="ItemList" type="ItemList" parent="HBoxContainer"]
|
||||
layout_mode = 2
|
||||
auto_width = true
|
||||
item_count = 6
|
||||
item_0/text = "Equpiment"
|
||||
item_1/text = "Abilities"
|
||||
item_2/text = "Items"
|
||||
item_3/text = "Quests"
|
||||
item_4/text = "Settings"
|
||||
item_5/text = "Save"
|
||||
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="PanelContainer" type="PanelContainer" parent="HBoxContainer2"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="HBoxContainer" type="GridContainer" parent="HBoxContainer2/PanelContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 8
|
||||
theme_override_constants/h_separation = 8
|
||||
columns = 2
|
||||
|
||||
[node name="Money" type="Label" parent="HBoxContainer2/PanelContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "%MONEY%"
|
||||
|
||||
[node name="Playtime" type="Label" parent="HBoxContainer2/PanelContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "%PLAYTIME%"
|
19
ui/pause/PauseMenu.gd
Normal file
19
ui/pause/PauseMenu.gd
Normal file
@@ -0,0 +1,19 @@
|
||||
class_name PauseMenu extends Control
|
||||
|
||||
@export var MAIN:PauseMain
|
||||
@export var SETTINGS:PauseSettings
|
||||
|
||||
func _ready() -> void:
|
||||
close()
|
||||
|
||||
func isOpen() -> bool:
|
||||
return visible
|
||||
|
||||
func open() -> void:
|
||||
visible = true
|
||||
MAIN.open()
|
||||
|
||||
func close() -> void:
|
||||
visible = false
|
||||
MAIN.close()
|
||||
SETTINGS.close()
|
1
ui/pause/PauseMenu.gd.uid
Normal file
1
ui/pause/PauseMenu.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cgvf34t5qgwbm
|
22
ui/pause/PauseMenu.tscn
Normal file
22
ui/pause/PauseMenu.tscn
Normal file
@@ -0,0 +1,22 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://c0i5e2dj11d8c"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://bt0okj2rie8qf" path="res://ui/pause/PauseMain.tscn" id="1_33nyv"]
|
||||
[ext_resource type="Script" uid="uid://cgvf34t5qgwbm" path="res://ui/pause/PauseMenu.gd" id="1_82qxy"]
|
||||
[ext_resource type="PackedScene" uid="uid://qgk5trrh6dfd" path="res://ui/pause/PauseSettings.tscn" id="2_3djnw"]
|
||||
|
||||
[node name="PauseMenu" type="Control" node_paths=PackedStringArray("MAIN", "SETTINGS")]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_82qxy")
|
||||
MAIN = NodePath("PauseMain")
|
||||
SETTINGS = NodePath("PauseSettings")
|
||||
|
||||
[node name="PauseSettings" parent="." instance=ExtResource("2_3djnw")]
|
||||
layout_mode = 1
|
||||
|
||||
[node name="PauseMain" parent="." instance=ExtResource("1_33nyv")]
|
||||
layout_mode = 1
|
10
ui/pause/PauseSettings.gd
Normal file
10
ui/pause/PauseSettings.gd
Normal file
@@ -0,0 +1,10 @@
|
||||
class_name PauseSettings extends Control
|
||||
|
||||
func open() -> void:
|
||||
visible = true
|
||||
|
||||
func close() -> void:
|
||||
visible = false
|
||||
|
||||
func isOpen() -> bool:
|
||||
return visible
|
1
ui/pause/PauseSettings.gd.uid
Normal file
1
ui/pause/PauseSettings.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://ba4ehmcr8tl1e
|
24
ui/pause/PauseSettings.tscn
Normal file
24
ui/pause/PauseSettings.tscn
Normal file
@@ -0,0 +1,24 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://qgk5trrh6dfd"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://ba4ehmcr8tl1e" path="res://ui/pause/PauseSettings.gd" id="1_ln7xx"]
|
||||
[ext_resource type="PackedScene" uid="uid://d3f31lli1ahts" path="res://ui/settings/SettingsMenu.tscn" id="2_jocxh"]
|
||||
|
||||
[node name="PauseSettings" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_ln7xx")
|
||||
|
||||
[node name="Panel" type="Panel" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="SettingsMenu" parent="Panel" instance=ExtResource("2_jocxh")]
|
||||
layout_mode = 1
|
15
ui/settings/SettingsMenu.gd
Normal file
15
ui/settings/SettingsMenu.gd
Normal file
@@ -0,0 +1,15 @@
|
||||
class_name SettingsMenu extends Control
|
||||
|
||||
@export var tabs:TabBar
|
||||
@export var tabControls:Array[Control]
|
||||
|
||||
func _ready() -> void:
|
||||
tabs.tab_changed.connect(onTabChanged)
|
||||
onTabChanged(tabs.current_tab)
|
||||
|
||||
func onTabChanged(tabIndex:int) -> void:
|
||||
for control in tabControls:
|
||||
control.visible = false
|
||||
|
||||
if tabIndex >= 0 and tabIndex < tabControls.size():
|
||||
tabControls[tabIndex].visible = true
|
1
ui/settings/SettingsMenu.gd.uid
Normal file
1
ui/settings/SettingsMenu.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://efmr0xkbw1py
|
49
ui/settings/SettingsMenu.tscn
Normal file
49
ui/settings/SettingsMenu.tscn
Normal file
@@ -0,0 +1,49 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://d3f31lli1ahts"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://efmr0xkbw1py" path="res://ui/settings/SettingsMenu.gd" id="1_4lnig"]
|
||||
|
||||
[node name="SettingsMenu" type="Control" node_paths=PackedStringArray("tabs", "tabControls")]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_4lnig")
|
||||
tabs = NodePath("VBoxContainer/TabBar")
|
||||
tabControls = [NodePath("VBoxContainer/ScrollContainer/LabelGameplay"), NodePath("VBoxContainer/ScrollContainer/LabelSound"), NodePath("VBoxContainer/ScrollContainer/LabelGraphics")]
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="TabBar" type="TabBar" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
current_tab = 0
|
||||
tab_count = 3
|
||||
tab_0/title = "Gameplay"
|
||||
tab_1/title = "Sound"
|
||||
tab_2/title = "Graphics"
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="LabelGraphics" type="Label" parent="VBoxContainer/ScrollContainer"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
text = "Graphics"
|
||||
|
||||
[node name="LabelSound" type="Label" parent="VBoxContainer/ScrollContainer"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
text = "Sound"
|
||||
|
||||
[node name="LabelGameplay" type="Label" parent="VBoxContainer/ScrollContainer"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
text = "Gameplay"
|
Reference in New Issue
Block a user