Initial push
This commit is contained in:
commit
3240f07946
335 changed files with 11248 additions and 0 deletions
33
Scripts/Menu/inventory_menu.gd
Normal file
33
Scripts/Menu/inventory_menu.gd
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
extends Node
|
||||
|
||||
class_name InventoryMenu
|
||||
|
||||
|
||||
@onready var inventory : Inventory
|
||||
@onready var item_list : VBoxContainer = $CanvasLayer/PanelContainer/VBoxContainer/MarginContainer/ScrollContainer/VBoxContainer
|
||||
var item_scene : PackedScene = preload("res://Scenes/Menu/InventoryUiItem.tscn")
|
||||
|
||||
func _ready() -> void:
|
||||
$CanvasLayer.hide()
|
||||
pass
|
||||
|
||||
|
||||
func toggle_inventory() -> bool:
|
||||
var canvas = $CanvasLayer
|
||||
if canvas.visible == true:
|
||||
$CanvasLayer.hide()
|
||||
return false
|
||||
else:
|
||||
update_inventory()
|
||||
$CanvasLayer.show()
|
||||
return true
|
||||
|
||||
func update_inventory():
|
||||
for i in inventory.items:
|
||||
var new_item = item_scene.instantiate()
|
||||
# new_item.set_values(i.item.name, i.item.value, i.item.weight)
|
||||
item_list.add_child(new_item)
|
||||
new_item.set_values(i.item.name, 10, 10)
|
||||
print(i.item.name)
|
||||
print(i)
|
||||
pass
|
||||
1
Scripts/Menu/inventory_menu.gd.uid
Normal file
1
Scripts/Menu/inventory_menu.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://ddwvtegkiite7
|
||||
11
Scripts/Menu/inventory_ui_item.gd
Normal file
11
Scripts/Menu/inventory_ui_item.gd
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
extends Node
|
||||
|
||||
@onready var title : Label = $Name
|
||||
@onready var value : Label = $Value
|
||||
@onready var weight : Label = $Weight
|
||||
|
||||
|
||||
func set_values(new_title : String, new_value : int, new_weight : int) -> void:
|
||||
title.text = new_title
|
||||
value.text = str(new_value)
|
||||
weight.text = str(new_weight)
|
||||
1
Scripts/Menu/inventory_ui_item.gd.uid
Normal file
1
Scripts/Menu/inventory_ui_item.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://bv3glh0xi771m
|
||||
169
Scripts/Menu/lobby_menu.gd
Normal file
169
Scripts/Menu/lobby_menu.gd
Normal file
|
|
@ -0,0 +1,169 @@
|
|||
class_name LobbyMenu
|
||||
extends Node
|
||||
|
||||
|
||||
#region Onready Variables
|
||||
|
||||
@onready var lobby_container : Container = $LobbyContainer
|
||||
@onready var username : LineEdit = $VBoxContainer/Name
|
||||
@onready var lobby_label : Label = $VBoxContainer/HBoxContainer/LobbyLabel
|
||||
@onready var steam_lobby_id_button : Button = $VBoxContainer/HBoxContainer/SteamLobbyIdButton
|
||||
@onready var disconnect_button : Button = $VBoxContainer/HBoxContainer/Disconnect
|
||||
@onready var tab_container : TabContainer = $VBoxContainer/TabContainer
|
||||
|
||||
@onready var steam_tab : Control = $VBoxContainer/TabContainer/Steam
|
||||
@onready var steam_address_entry : LineEdit = $VBoxContainer/TabContainer/Steam/PanelContainer/MarginContainer/VBoxContainer/Address
|
||||
@onready var steam_host_button : Button = $VBoxContainer/TabContainer/Steam/PanelContainer/MarginContainer/VBoxContainer/Host
|
||||
@onready var steam_join_button : Button = $VBoxContainer/TabContainer/Steam/PanelContainer/MarginContainer/VBoxContainer/Join
|
||||
|
||||
@onready var enet_address_entry : LineEdit = $VBoxContainer/TabContainer/ENet/PanelContainer/MarginContainer/VBoxContainer/Address
|
||||
@onready var enet_host_toggle : CheckButton = $VBoxContainer/TabContainer/ENet/PanelContainer/MarginContainer/VBoxContainer/HostToggleContainer/Host
|
||||
@onready var enet_join_button : Button = $VBoxContainer/TabContainer/ENet/PanelContainer/MarginContainer/VBoxContainer/Join
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Variables
|
||||
|
||||
var steam_lobby_id : String = ""
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Signals
|
||||
|
||||
signal disconnect_button_pressed()
|
||||
|
||||
signal steam_host_pressed(new_username : String)
|
||||
signal steam_join_pressed(new_username : String)
|
||||
|
||||
signal enet_host_toggled_on(new_username : String)
|
||||
signal enet_host_toggled_off()
|
||||
signal enet_join_pressed(new_username : String)
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Godot Functions
|
||||
|
||||
func _ready() -> void:
|
||||
#set username to steam username
|
||||
username.text = "username"
|
||||
|
||||
disconnect_button.pressed.connect(_on_disconnet_button_pressed)
|
||||
|
||||
#steam
|
||||
if Global.steam_connected == true:
|
||||
username.text = Steam.getPersonaName()
|
||||
|
||||
steam_lobby_id_button.pressed.connect(_on_steam_lobby_id_button_pressed)
|
||||
steam_host_button.pressed.connect(_on_steam_host_pressed)
|
||||
steam_join_button.pressed.connect(_on_steam_join_pressed)
|
||||
|
||||
#enet
|
||||
enet_host_toggle.toggled.connect(_on_enet_host_toggled)
|
||||
enet_join_button.pressed.connect(_on_enet_join_pressed)
|
||||
|
||||
if Global.steam_connected == false:
|
||||
tab_container.remove_child(steam_tab)
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Public Functions
|
||||
|
||||
func reset_visible() -> void:
|
||||
steam_lobby_id_button.hide()
|
||||
disconnect_button.hide()
|
||||
clear_lobby_text()
|
||||
username.show()
|
||||
|
||||
#steam
|
||||
steam_join_button.show()
|
||||
steam_address_entry.show()
|
||||
steam_host_button.show()
|
||||
|
||||
#enet
|
||||
tab_container.tabs_visible = true
|
||||
tab_container.show()
|
||||
enet_address_entry.show()
|
||||
enet_join_button.show()
|
||||
|
||||
func request_lobby_list() -> void:
|
||||
for child in lobby_container.get_children():
|
||||
child.queue_free()
|
||||
|
||||
Steam.requestLobbyList()
|
||||
|
||||
func set_lobby_text(new_names : Array[String]) -> void:
|
||||
clear_lobby_text()
|
||||
|
||||
for new_name in new_names:
|
||||
var name_label : Label = Label.new()
|
||||
name_label.text = new_name
|
||||
lobby_container.add_child(name_label)
|
||||
|
||||
func clear_lobby_text() -> void:
|
||||
var lobby_container_children = lobby_container.get_children()
|
||||
for child in lobby_container_children:
|
||||
child.free()
|
||||
|
||||
func update_steam_lobby_id_button():
|
||||
steam_lobby_id_button.show()
|
||||
steam_lobby_id = Global.steam_lobby_id
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Signal Functions
|
||||
func _on_disconnet_button_pressed() -> void:
|
||||
disconnect_button_pressed.emit()
|
||||
|
||||
func _on_steam_host_pressed() -> void:
|
||||
steam_host_pressed.emit(username.text)
|
||||
steam_join_button.hide()
|
||||
tab_container.tabs_visible = false
|
||||
steam_address_entry.hide()
|
||||
steam_host_button.hide()
|
||||
username.hide()
|
||||
|
||||
func _on_steam_join_pressed() -> void:
|
||||
Global.steam_lobby_id = steam_address_entry.text
|
||||
steam_join_pressed.emit(username.text)
|
||||
steam_join_button.hide()
|
||||
tab_container.tabs_visible = false
|
||||
steam_address_entry.hide()
|
||||
steam_host_button.hide()
|
||||
username.hide()
|
||||
disconnect_button.show()
|
||||
|
||||
func _on_enet_host_toggled(toggled_on : bool) -> void:
|
||||
if toggled_on:
|
||||
enet_address_entry.hide()
|
||||
enet_join_button.hide()
|
||||
username.hide()
|
||||
enet_host_toggled_on.emit(username.text)
|
||||
tab_container.tabs_visible = false
|
||||
return
|
||||
|
||||
tab_container.tabs_visible = true
|
||||
enet_host_toggled_off.emit()
|
||||
enet_address_entry.show()
|
||||
enet_join_button.show()
|
||||
username.show()
|
||||
|
||||
func _on_enet_join_pressed() -> void:
|
||||
if enet_address_entry.text.is_empty() == false:
|
||||
Global.enet_address = enet_address_entry.text
|
||||
|
||||
tab_container.tabs_visible = false
|
||||
enet_join_pressed.emit(username.text)
|
||||
enet_join_button.hide()
|
||||
tab_container.hide()
|
||||
username.hide()
|
||||
disconnect_button.show()
|
||||
|
||||
func _on_steam_lobby_id_button_pressed():
|
||||
DisplayServer.clipboard_set(steam_lobby_id)
|
||||
|
||||
#endregion
|
||||
1
Scripts/Menu/lobby_menu.gd.uid
Normal file
1
Scripts/Menu/lobby_menu.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://b2pee67ics25u
|
||||
Loading…
Add table
Add a link
Reference in a new issue