Change 2 for cleanup

This commit is contained in:
PersonGuyGit
2023-07-09 12:28:09 -06:00
parent 707e8a5b16
commit 2c971b6e7c
1741 changed files with 0 additions and 0 deletions

View File

@ -0,0 +1,3 @@
source_md5="47313fa4c47a9963fddd764e1ec6e4a8"
dest_md5="26ea799ea0a3da9e753b3ebe822e0570"

View File

@ -0,0 +1,18 @@
#BUT_CHANGESCENE:
# Generic template script allowing GUI linking of scenes by button press.
tool
extends Button
#Creates param usable in the UI; and the params next to export make it string and file browser
export(String, FILE) var next_scene_path: = ""
var tempToggle = 0
func _on_But_NewGame_button_up():
get_tree().change_scene(next_scene_path)
func _get_configuration_warning() -> String:
return "next_scene_path must be set for this button to work" if next_scene_path == "" else ""

View File

@ -0,0 +1,9 @@
extends Node
func _instance_node(node: Object, parent: Object) -> Object:
var node_instance = node.instance()
parent.add_child(node_instance)
return node_instance

View File

@ -0,0 +1,53 @@
extends Node
const DEFAULT_PORT = 28960
const MAX_CLIENTS = 6
var server = null
var client = null
var player_counter = 1
var player = load("res://Player.tscn")
var ip_address = ""
var room_name = ""
var room_password = ""
func _ready() -> void:
ip_address = IP.get_local_addresses()[3]
for ip in IP.get_local_addresses():
if ip.begins_with("192.168.") and not ip.ends_with(".1"):
ip_address = ip
get_tree().connect("connected_to_server", self, "_connected_to_server")
get_tree().connect("server_disconnected", self, "_server_disconnected")
func _create_server() -> void:
server = NetworkedMultiplayerENet.new()
server.create_server(DEFAULT_PORT, MAX_CLIENTS)
get_tree().set_network_peer(server)
func _join_server() -> void:
client = NetworkedMultiplayerENet.new()
client.create_client(ip_address, DEFAULT_PORT)
get_tree().set_network_peer(client)
func _connected_to_server() -> void:
print("Successfully connected to the server")
func _server_disconnected() -> void:
print("Disconnected from the server")
func _set_server_info(name, password) -> void:
room_name = name
room_password = password
func _instance_player(id, name) -> void:
var player_instance = Global._instance_node(player, Players)
player_instance.name = str(id)
player_instance._set_name(name)
#Using player_counter to determine the positioning of the player's name on the screen
#So that they aren't all overlapping
player_instance._set_name_position(player_counter)
player_instance.set_network_master(id)
player_counter += 1

View File

@ -0,0 +1,53 @@
extends Control
var playerCounter = 1
var player = load("res://Player.tscn")
onready var multiplayer_config_ui = $Multiplayer_Configure
onready var server_ip_address = $Multiplayer_Configure/Server_IP_Address
onready var device_ip_address = $CanvasLayer/Device_IP_Address
# Called when the node enters the scene tree for the first time.
func _ready():
get_tree().connect("network_peer_connected", self, "_player_connected")
get_tree().connect("network_peer_disconnected", self, "_player_disconnected")
get_tree().connect("connected_to_server", self, "_connected_to_server")
device_ip_address.text = Network.ip_address
func _player_connected(id) -> void:
print("Player " + str(id) + "connected")
instance_player(id)
func _player_disconnected(id) -> void:
print("Player " + str(id) + "disconnected")
if Players.has_node(str(id)):
Players.get_node(str(id)).queue_free()
func _on_Create_Server_pressed():
multiplayer_config_ui.hide()
Network._create_server()
instance_player(get_tree().get_network_unique_id())
func _on_Join_Server_pressed():
if server_ip_address.text != "":
multiplayer_config_ui.hide()
Network.ip_address = server_ip_address.text
Network._join_server()
func _connected_to_server() -> void:
yield(get_tree().create_timer(0.1), "timeout")
instance_player(get_tree().get_network_unique_id())
func instance_player(id) -> void:
var player_instance = Global.instance_node(player, Players)
player_instance.name = str(id)
var player_name = "Player " + str(playerCounter)
player_instance._set_name(player_name)
player_instance._set_name_position(playerCounter)
player_instance.set_network_master(id)
playerCounter += 1

View File

@ -0,0 +1,62 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://But_ChangeScene.gd" type="Script" id=2]
[node name="Network_Setup" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
[node name="Multiplayer_Configure" type="Control" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
[node name="Create_Server" type="Button" parent="Multiplayer_Configure"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -125.0
margin_top = 21.0
margin_right = 125.0
margin_bottom = 121.0
text = "Create Server"
script = ExtResource( 2 )
next_scene_path = "res://Room_Creation.tscn"
[node name="Join_Server" type="Button" parent="Multiplayer_Configure"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -125.0
margin_top = -129.0
margin_right = 125.0
margin_bottom = -29.0
text = "Join Server"
script = ExtResource( 2 )
next_scene_path = "res://Room_Join.tscn"
[node name="Server_IP_Address" type="LineEdit" parent="Multiplayer_Configure"]
visible = false
margin_left = 389.0
margin_top = 82.0
margin_right = 639.0
margin_bottom = 132.0
text = "Enter IP Address"
align = 1
[node name="CanvasLayer" type="CanvasLayer" parent="."]
[node name="Device_IP_Address" type="Label" parent="CanvasLayer"]
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = -1.0
margin_top = -76.0
margin_right = -1.0
margin_bottom = -26.0
align = 1
valign = 1
[connection signal="button_up" from="Multiplayer_Configure/Create_Server" to="Multiplayer_Configure/Create_Server" method="_on_But_NewGame_button_up"]
[connection signal="button_up" from="Multiplayer_Configure/Join_Server" to="Multiplayer_Configure/Join_Server" method="_on_But_NewGame_button_up"]

View File

@ -0,0 +1,7 @@
extends Control
func _set_name(name) -> void:
$Name.text = name
func _set_name_position(counterVal) -> void:
$Name.rect_position.y = -225 + (50 * counterVal)

View File

@ -0,0 +1,26 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://Player.gd" type="Script" id=1]
[node name="Player" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 1 )
[node name="Name" type="Label" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
margin_top = -175.0
margin_bottom = -175.0
text = "Name"
align = 1
valign = 1
[node name="Players" type="Label" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
margin_top = -225.0
margin_bottom = -225.0
text = "Players:"
align = 1
valign = 1

View File

@ -0,0 +1,3 @@
[gd_scene format=2]
[node name="Players" type="Node"]

View File

@ -0,0 +1,53 @@
extends Control
var playerCounter = 1
var player = load("res://Player.tscn")
onready var multiplayer_config_ui = $Multiplayer_Configure
#onready var server_ip_address = $Multiplayer_Configure/Server_IP_Address
onready var device_ip_address = $CanvasLayer/Device_IP_Address
onready var player_name = $Multiplayer_Configure/Player_Name
onready var room_name = $Multiplayer_Configure/Room_Name
onready var room_password = $Multiplayer_Configure/Room_Password
onready var room_ui = $Room_UI
# Called when the node enters the scene tree for the first time.
func _ready():
get_tree().connect("network_peer_connected", self, "_player_connected")
get_tree().connect("network_peer_disconnected", self, "_player_disconnected")
get_tree().connect("connected_to_server", self, "_connected_to_server")
device_ip_address.text = Network.ip_address
func _player_connected(id) -> void:
print("Player " + str(id) + "connected")
Network._instance_player(id, "New Player")
func _player_disconnected(id) -> void:
print("Player " + str(id) + "disconnected")
if Players.has_node(str(id)):
Players.get_node(str(id)).queue_free()
func _on_Create_Server_pressed():
multiplayer_config_ui.hide()
Network._create_server()
Network._instance_player(get_tree().get_network_unique_id(), player_name.text)
Network._set_server_info(room_name.text, room_password.text)
$Room_UI/Room_Name.text = room_name.text
room_ui.show()
#func _on_Join_Server_pressed():
# if server_ip_address.text != "":
# multiplayer_config_ui.hide()
# Network.ip_address = server_ip_address.text
# Network._join_server()
func _connected_to_server() -> void:
yield(get_tree().create_timer(0.1), "timeout")
Network._instance_player(get_tree().get_network_unique_id(), player_name.text)

View File

@ -0,0 +1,91 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://Room_Creation.gd" type="Script" id=1]
[ext_resource path="res://But_ChangeScene.gd" type="Script" id=2]
[node name="Room_Creation" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 1 )
[node name="Back" type="Button" parent="."]
margin_left = 312.0
margin_top = 419.0
margin_right = 474.0
margin_bottom = 493.0
text = "Back"
script = ExtResource( 2 )
next_scene_path = "res://Network_Setup.tscn"
[node name="Multiplayer_Configure" type="Control" parent="."]
margin_right = 40.0
margin_bottom = 40.0
[node name="Create_Server" type="Button" parent="Multiplayer_Configure"]
margin_left = 592.0
margin_top = 419.0
margin_right = 754.0
margin_bottom = 493.0
text = "Create"
[node name="Room_Name" type="LineEdit" parent="Multiplayer_Configure"]
margin_left = 452.0
margin_top = 250.0
margin_right = 619.0
margin_bottom = 274.0
text = "Room Name"
align = 1
[node name="Room_Password" type="LineEdit" parent="Multiplayer_Configure"]
margin_left = 452.0
margin_top = 315.0
margin_right = 619.0
margin_bottom = 339.0
text = "Room Password"
align = 1
[node name="Player_Name" type="LineEdit" parent="Multiplayer_Configure"]
margin_left = 451.0
margin_top = 188.0
margin_right = 618.0
margin_bottom = 212.0
text = "Player Name"
align = 1
[node name="CanvasLayer" type="CanvasLayer" parent="."]
[node name="Device_IP_Address" type="Label" parent="CanvasLayer"]
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = -1.0
margin_top = -76.0
margin_right = -1.0
margin_bottom = -26.0
align = 1
valign = 1
[node name="Room_UI" type="Control" parent="."]
visible = false
anchor_right = 1.0
anchor_bottom = 1.0
[node name="Room_Name" type="Label" parent="Room_UI"]
anchor_left = 0.5
anchor_right = 0.5
margin_left = -80.5
margin_right = 80.5
margin_bottom = 14.0
align = 1
[node name="Players" type="Label" parent="Room_UI"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_top = -225.0
margin_bottom = -225.0
text = "Players:"
align = 1
valign = 1
[connection signal="button_up" from="Back" to="Back" method="_on_But_NewGame_button_up"]
[connection signal="pressed" from="Multiplayer_Configure/Create_Server" to="." method="_on_Create_Server_pressed"]

View File

@ -0,0 +1,13 @@
extends Control
onready var multiplayer_config_ui = $Multiplayer_Configure
onready var server_ip_address = $Multiplayer_Configure/Server_IP_Address
onready var room_password = $Multiplayer_Configure/Room_Password
onready var player_name = $Multiplayer_Configure/Player_Name
func _on_Join_Server_pressed():
if server_ip_address.text != "":
multiplayer_config_ui.hide()
Network.ip_address = server_ip_address.text
Network._join_server()
Network._instance_player(get_tree().get_network_unique_id(), player_name.text)

View File

@ -0,0 +1,60 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://Room_Join.gd" type="Script" id=1]
[ext_resource path="res://But_ChangeScene.gd" type="Script" id=2]
[node name="Room_Join" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 1 )
[node name="Multiplayer_Configure" type="Control" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
[node name="Server_IP_Address" type="LineEdit" parent="Multiplayer_Configure"]
margin_left = 386.0
margin_top = 236.0
margin_right = 636.0
margin_bottom = 286.0
text = "Enter Room IP"
align = 1
[node name="Join_Server" type="Button" parent="Multiplayer_Configure"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = 21.0
margin_top = 93.0
margin_right = 271.0
margin_bottom = 193.0
text = "Join Server"
[node name="Room_Password" type="LineEdit" parent="Multiplayer_Configure"]
margin_left = 388.0
margin_top = 311.0
margin_right = 638.0
margin_bottom = 361.0
text = "Room Password"
align = 1
[node name="Player_Name" type="LineEdit" parent="Multiplayer_Configure"]
margin_left = 387.0
margin_top = 164.0
margin_right = 637.0
margin_bottom = 214.0
text = "Player Name"
align = 1
[node name="Back" type="Button" parent="."]
margin_left = 235.0
margin_top = 394.0
margin_right = 485.0
margin_bottom = 494.0
text = "Back"
script = ExtResource( 2 )
next_scene_path = "res://Network_Setup.tscn"
[connection signal="pressed" from="Multiplayer_Configure/Join_Server" to="." method="_on_Join_Server_pressed"]
[connection signal="button_up" from="Back" to="Back" method="_on_But_NewGame_button_up"]

View File

@ -0,0 +1,7 @@
[gd_resource type="Environment" load_steps=2 format=2]
[sub_resource type="ProceduralSky" id=1]
[resource]
background_mode = 2
background_sky = SubResource( 1 )

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.png"
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View File

@ -0,0 +1,29 @@
; Engine configuration file.
; It's best edited using the editor UI and not directly,
; since the parameters that go here are not all obvious.
;
; Format:
; [section] ; section goes between []
; param=value ; assign values to parameters
config_version=4
[application]
config/name="Multiplayer Test"
run/main_scene="res://Network_Setup.tscn"
config/icon="res://icon.png"
[autoload]
Network="*res://Network.gd"
Global="*res://Global.gd"
Players="*res://Players.tscn"
[physics]
common/enable_pause_aware_picking=true
[rendering]
environment/default_environment="res://default_env.tres"

View File

@ -0,0 +1,3 @@
source_md5="266f789a4e895911161321092c2c2429"
dest_md5="a08a6dcf169f683724bfd5cd82e23fe6"

View File

@ -0,0 +1,3 @@
source_md5="47313fa4c47a9963fddd764e1ec6e4a8"
dest_md5="2ded9e7f9060e2b530aab678b135fc5b"

View File

@ -0,0 +1,5 @@
[gd_scene format=2]
[node name="Control" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0

View File

@ -0,0 +1,13 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://UserInterface/Title.tscn" type="PackedScene" id=1]
[node name="Control" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Title" parent="." instance=ExtResource( 1 )]
text = "Add Character (temp)"

View File

@ -0,0 +1,13 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://UserInterface/Title.tscn" type="PackedScene" id=1]
[node name="Control" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Title" parent="." instance=ExtResource( 1 )]
text = "Load game (temp)"

View File

@ -0,0 +1,94 @@
[gd_scene load_steps=7 format=2]
[ext_resource path="res://UserInterface/But_ChangeScene.tscn" type="PackedScene" id=1]
[ext_resource path="res://UserInterface/Title.tscn" type="PackedScene" id=5]
[ext_resource path="res://assets/background_demo.png" type="Texture" id=7]
[ext_resource path="res://assets/ui_theme.tres" type="Theme" id=8]
[ext_resource path="res://assets/ui_title_theme.tres" type="Theme" id=9]
[ext_resource path="res://UserInterface/But_Quit.tscn" type="PackedScene" id=10]
[node name="MenuScreen" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
theme = ExtResource( 8 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="background_demo" type="TextureRect" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
texture = ExtResource( 7 )
expand = true
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Title" parent="." instance=ExtResource( 5 )]
margin_top = 51.8676
margin_bottom = 117.868
theme = ExtResource( 9 )
[node name="VBoxContainer" type="VBoxContainer" parent="."]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -119.0
margin_top = -152.0
margin_right = 119.0
margin_bottom = 152.0
rect_scale = Vector2( 1.04675, 1.07389 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="But_NewGame" parent="VBoxContainer" instance=ExtResource( 1 )]
margin_right = 238.0
margin_bottom = 48.0
next_scene_path = "res://Screens/NewGame_temp.tscn"
[node name="But_LoadGame" parent="VBoxContainer" instance=ExtResource( 1 )]
margin_top = 52.0
margin_right = 238.0
margin_bottom = 100.0
text = "Load Game"
next_scene_path = "res://Screens/LoadGame_temp.tscn"
[node name="But_Multiplayer" parent="VBoxContainer" instance=ExtResource( 1 )]
margin_top = 104.0
margin_right = 238.0
margin_bottom = 152.0
text = "Multiplayer"
next_scene_path = "res://Screens/Multiplayer_temp.tscn"
[node name="But_AddChar" parent="VBoxContainer" instance=ExtResource( 1 )]
margin_top = 156.0
margin_right = 238.0
margin_bottom = 204.0
text = "Add Character"
next_scene_path = "res://Screens/AddCharacter_temp.tscn"
[node name="But_Settings" parent="VBoxContainer" instance=ExtResource( 1 )]
margin_top = 208.0
margin_right = 238.0
margin_bottom = 256.0
text = "Settings"
next_scene_path = "res://Screens/Settings.tscn"
[node name="But_Quit" parent="VBoxContainer" instance=ExtResource( 10 )]
margin_top = 260.0
margin_right = 238.0
margin_bottom = 304.0
[node name="Version" type="Label" parent="."]
anchor_left = 1.0
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = -165.0
margin_top = -38.0
text = "Version: 0.0.0"
__meta__ = {
"_edit_use_anchors_": false
}

View File

@ -0,0 +1,13 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://UserInterface/Title.tscn" type="PackedScene" id=1]
[node name="Control" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Title" parent="." instance=ExtResource( 1 )]
text = "Multiplayer (temp)"

View File

@ -0,0 +1,13 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://UserInterface/Title.tscn" type="PackedScene" id=1]
[node name="Control" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="newGameTextTemp" parent="." instance=ExtResource( 1 )]
text = "Start new game (temp)"

View File

@ -0,0 +1,130 @@
[gd_scene load_steps=10 format=2]
[ext_resource path="res://UserInterface/Title.tscn" type="PackedScene" id=1]
[ext_resource path="res://assets/background_demo.png" type="Texture" id=2]
[ext_resource path="res://assets/ui_theme.tres" type="Theme" id=3]
[ext_resource path="res://assets/ui_title_theme.tres" type="Theme" id=4]
[ext_resource path="res://UserInterface/But_ChangeScene.tscn" type="PackedScene" id=5]
[ext_resource path="res://Screens/inputText.gd" type="Script" id=6]
[ext_resource path="res://assets/base_dynamicfont.tres" type="DynamicFont" id=7]
[ext_resource path="res://UserInterface/But_SaveSettings.gd" type="Script" id=8]
[ext_resource path="res://Screens/SettingsInitialize.gd" type="Script" id=9]
[node name="SettingsScreen" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
theme = ExtResource( 3 )
script = ExtResource( 9 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="background_demo" type="TextureRect" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
texture = ExtResource( 2 )
expand = true
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Title" parent="." instance=ExtResource( 1 )]
anchor_left = 0.0
anchor_right = 0.0
margin_left = 0.0
margin_top = 0.0
margin_right = 296.0
margin_bottom = 135.0
theme = ExtResource( 4 )
text = " Player Settings
"
[node name="Hbox_buttons" type="HBoxContainer" parent="."]
anchor_left = 1.0
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = -426.0
margin_top = -67.0
grow_vertical = 0
rect_scale = Vector2( 1.04675, 1.07389 )
alignment = 2
__meta__ = {
"_edit_use_anchors_": false
}
[node name="But_SaveSettings" parent="Hbox_buttons" instance=ExtResource( 5 )]
margin_right = 164.0
margin_bottom = 67.0
text = "Save Settings"
script = ExtResource( 8 )
next_scene_path = "res://Screens/MenuScreen.tscn"
[node name="But_CloseWithoutSaving" parent="Hbox_buttons" instance=ExtResource( 5 )]
margin_left = 168.0
margin_right = 426.0
margin_bottom = 67.0
grow_horizontal = 0
grow_vertical = 0
text = "Close Without Saving"
next_scene_path = "res://Screens/MenuScreen.tscn"
[node name="VBoxContainer" type="VBoxContainer" parent="."]
anchor_top = 0.5
anchor_bottom = 0.5
margin_top = -187.879
margin_right = 605.0
margin_bottom = -115.879
__meta__ = {
"_edit_use_anchors_": false
}
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
margin_right = 605.0
margin_bottom = 48.0
[node name="label_disName" type="Label" parent="VBoxContainer/HBoxContainer"]
margin_top = 5.0
margin_right = 175.0
margin_bottom = 43.0
size_flags_horizontal = 2
text = "Display Name: "
__meta__ = {
"_edit_use_anchors_": false
}
[node name="input_name" type="LineEdit" parent="VBoxContainer/HBoxContainer"]
margin_left = 304.0
margin_right = 605.0
margin_bottom = 48.0
size_flags_horizontal = 3
custom_fonts/font = ExtResource( 7 )
max_length = 48
script = ExtResource( 6 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer"]
margin_top = 52.0
margin_right = 605.0
margin_bottom = 100.0
[node name="label_risk" type="Label" parent="VBoxContainer/HBoxContainer2"]
margin_top = 5.0
margin_right = 300.0
margin_bottom = 43.0
size_flags_horizontal = 3
text = "Risk Factor Threshold: "
__meta__ = {
"_edit_use_anchors_": false
}
[node name="input_risk" type="LineEdit" parent="VBoxContainer/HBoxContainer2"]
margin_left = 304.0
margin_right = 605.0
margin_bottom = 48.0
size_flags_horizontal = 3
__meta__ = {
"_edit_use_anchors_": false
}

View File

@ -0,0 +1,12 @@
extends Control
onready var psCurrentSettings = get_node("/root/PlayerSettings")
func _ready() -> void:
var inputName = get_node("VBoxContainer/HBoxContainer/input_name")
var inputRisk = get_node("VBoxContainer/HBoxContainer2/input_risk")
inputName.text = psCurrentSettings.playerSettingsSingleton.inputName
inputRisk.text = psCurrentSettings.playerSettingsSingleton.riskFactor

View File

@ -0,0 +1,7 @@
extends LineEdit
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
grab_focus()

View File

@ -0,0 +1,15 @@
#Tool lets you any code in editor, such as plugins
tool
extends Button
#Creates param usable in the UI; and the params next to export make it string and file browser
export(String, FILE) var next_scene_path: = ""
func _on_But_NewGame_button_up():
get_tree().change_scene(next_scene_path)
func _get_configuration_warning() -> String:
return "next_scene_path must be set for this button to work" if next_scene_path == "" else ""

View File

@ -0,0 +1,15 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://UserInterface/But_ChangeScene.gd" type="Script" id=1]
[node name="But_ChangeScene" type="Button"]
margin_right = 130.0
margin_bottom = 24.0
size_flags_vertical = 3
text = "New Game"
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="button_up" from="." to="." method="_on_But_NewGame_button_up"]

View File

@ -0,0 +1,6 @@
extends Button
func _on_But_Quit_button_up():
get_tree().quit()

View File

@ -0,0 +1,15 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://UserInterface/But_Quit.gd" type="Script" id=1]
[node name="But_Quit" type="Button"]
margin_top = 240.0
margin_right = 179.0
margin_bottom = 284.0
text = "Quit"
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="button_up" from="." to="." method="_on_But_Quit_button_up"]

View File

@ -0,0 +1,64 @@
#Script for settings save button
#Tool lets you any code in editor, such as plugins
tool
extends Button
#Creates param usable in the UI; and the params next to export make it string and file browser
export(String, FILE) var next_scene_path: = ""
#Button response: save settings and move on.
func _on_But_NewGame_button_up():
var inputName = get_node("../../VBoxContainer/HBoxContainer/input_name")
var inputRisk = get_node("../../VBoxContainer/HBoxContainer2/input_risk")
_saveSettings(inputName.text, inputRisk.text)
get_tree().change_scene(next_scene_path)
#HELPER FUNCTIONS:
func _get_configuration_warning() -> String:
return "next_scene_path must be set for this button to work" if next_scene_path == "" else ""
func _saveSettings(inputSettings : String, riskFactor : String) -> void:
var player_settings = get_node("/root/PlayerSettings")
player_settings.playerSettingsSingleton.inputName = inputSettings
player_settings.playerSettingsSingleton.riskFactor = riskFactor
#Temp:
var temp_manual_JSON = {
"playerSettingsTemplate": {
"inputName": inputSettings,
"riskFactor": riskFactor
}
}
#Save to file (JSON for now)
var settings_file = "user://testPlayerSettings.sav"
var file = File.new()
if file.open(settings_file, File.WRITE) != 0:
print("Cannot write temporary file to: " + settings_file)
else:
file.store_line(to_json(temp_manual_JSON))
file.close()
#****This save Settings functions as designed; but modified to work with alternate approach of loading
#func _saveSettings(inputSettings : String, riskFactor : String) -> void:
#Debugging:
# print("Input name: " + inputSettings + "; and risk factor set to : " + riskFactor)
# var player_settings = get_node("/root/PlayerSettings")
# player_settings.playerSettingsSingleton.inputName = inputSettings
# player_settings.playerSettingsSingleton.riskFactor = riskFactor
#Save to file (for now)
# if settings_save_file_name == "":
# settings_save_file_name = "settings.save"
# var settings_file = "user://" + settings_save_file_name
# var file = File.new()
# file.open(settings_file, File.WRITE)
# file.store_var(player_settings.playerSettingsSingleton.inputName)
#DKM TEMP: To save object; removed for testing
#file.store_var(player_settings.playerSettingsSingleton, true)
# file.close()

View File

@ -0,0 +1,17 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://assets/base_dynamicFont_BIG.tres" type="DynamicFont" id=1]
[node name="Title" type="Label"]
anchor_left = 0.5
anchor_right = 0.5
margin_left = -110.5
margin_top = 114.422
margin_right = 110.5
margin_bottom = 180.422
custom_fonts/font = ExtResource( 1 )
text = "Main Menu"
align = 1
__meta__ = {
"_edit_use_anchors_": false
}

View File

@ -0,0 +1,11 @@
[gd_scene format=2]
[node name="But_AddChar" type="Button"]
margin_top = 85.0
margin_right = 130.0
margin_bottom = 109.0
size_flags_vertical = 3
text = "Add Character"
__meta__ = {
"_edit_use_anchors_": false
}

View File

@ -0,0 +1,8 @@
[gd_scene format=2]
[node name="But_LoadGame" type="Button"]
margin_top = 28.0
margin_right = 130.0
margin_bottom = 52.0
size_flags_vertical = 3
text = "Load Game"

View File

@ -0,0 +1,11 @@
[gd_scene format=2]
[node name="But_Multiplayer" type="Button"]
margin_top = 56.0
margin_right = 130.0
margin_bottom = 81.0
size_flags_vertical = 3
text = "Multiplayer"
__meta__ = {
"_edit_use_anchors_": false
}

View File

@ -0,0 +1,8 @@
[gd_scene format=2]
[node name="But_Settings" type="Button"]
margin_top = 113.0
margin_right = 130.0
margin_bottom = 138.0
size_flags_vertical = 3
text = "Settings"

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/background_demo.png-bf78baa5e40d24f1836aa08964398dec.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/background_demo.png"
dest_files=[ "res://.import/background_demo.png-bf78baa5e40d24f1836aa08964398dec.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View File

@ -0,0 +1,7 @@
[gd_resource type="DynamicFont" load_steps=2 format=2]
[ext_resource path="res://assets/l_10646.ttf" type="DynamicFontData" id=1]
[resource]
size = 42
font_data = ExtResource( 1 )

View File

@ -0,0 +1,7 @@
[gd_resource type="DynamicFont" load_steps=2 format=2]
[ext_resource path="res://assets/l_10646.ttf" type="DynamicFontData" id=1]
[resource]
size = 24
font_data = ExtResource( 1 )

View File

@ -0,0 +1,6 @@
[gd_resource type="Theme" load_steps=2 format=2]
[ext_resource path="res://assets/base_dynamicfont.tres" type="DynamicFont" id=1]
[resource]
default_font = ExtResource( 1 )

View File

@ -0,0 +1,6 @@
[gd_resource type="Theme" load_steps=2 format=2]
[ext_resource path="res://assets/base_dynamicFont_BIG.tres" type="DynamicFont" id=1]
[resource]
default_font = ExtResource( 1 )

View File

@ -0,0 +1,7 @@
[gd_resource type="Environment" load_steps=2 format=2]
[sub_resource type="ProceduralSky" id=1]
[resource]
background_mode = 2
background_sky = SubResource( 1 )

View File

@ -0,0 +1,38 @@
#***PLAYER SETTINGS: a singleton to hold settings in-game. Currently for test
# purposes, initializes a playerSettingsTemplate class, and attempts to
# load in a saved player settings file. This then updates the singleton.
extends Node
var settings_file = "user://testPlayerSettings.sav"
var playerSettingsSingleton = PlayerSettingsTemplate.new()
func _ready() -> void:
load_settings_file()
#Using JSON:
#DKM TEMP: manual JSON parsing is most certainly not the way to go -- temp testing these
# are saved and loaded correctly.
func load_settings_file():
var file = File.new()
file.open(settings_file, file.READ)
var text = file.get_as_text()
var parsedText = parse_json(text)
if(parsedText != null):
print("Input name loaded as: " + parsedText.playerSettingsTemplate.inputName)
playerSettingsSingleton.inputName = parsedText.playerSettingsTemplate.inputName
playerSettingsSingleton.riskFactor = parsedText.playerSettingsTemplate.riskFactor
else:
print("No previously existing player settings file found")
#DKM TEMP:
#****THIS LOADS a string successfully, but not objects
#func _loadSettings() -> void:
#DKM TEMP: we cannot hard code this here and allow user access on But_SaveS UI
# var settings_file = "user://testSettings"
# var file = File.new()
# if file.file_exists(settings_file):
# file.open(settings_file, File.READ)
# playerSettingsSingleton.inputName = file.get_var()
# file.close()
# print("name found as: " + playerSettingsSingleton.inputName)

View File

@ -0,0 +1,5 @@
extends Node
class_name PlayerSettingsTemplate
var inputName = "None"
var riskFactor = "0"

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.png"
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View File

@ -0,0 +1,37 @@
; Engine configuration file.
; It's best edited using the editor UI and not directly,
; since the parameters that go here are not all obvious.
;
; Format:
; [section] ; section goes between []
; param=value ; assign values to parameters
config_version=4
_global_script_classes=[ {
"base": "Node",
"class": "PlayerSettingsTemplate",
"language": "GDScript",
"path": "res://globalScripts/playerSettingsTemplate.gd"
} ]
_global_script_class_icons={
"PlayerSettingsTemplate": ""
}
[application]
config/name="RPGR_moduleWork_21_1024"
run/main_scene="res://Screens/MenuScreen.tscn"
config/icon="res://icon.png"
[autoload]
PlayerSettings="*res://globalScripts/playerSettings.gd"
[physics]
common/enable_pause_aware_picking=true
[rendering]
environment/default_environment="res://default_env.tres"

View File

@ -0,0 +1,3 @@
source_md5="266f789a4e895911161321092c2c2429"
dest_md5="a08a6dcf169f683724bfd5cd82e23fe6"

View File

@ -0,0 +1,3 @@
source_md5="47313fa4c47a9963fddd764e1ec6e4a8"
dest_md5="2ded9e7f9060e2b530aab678b135fc5b"

View File

@ -0,0 +1,5 @@
[gd_scene format=2]
[node name="Control" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0

View File

@ -0,0 +1,38 @@
extends Control
#Abstract class we instance when wanted in game as child of HistoryReference
const InputResponse = preload("res://UserInterface/InputResponse.tscn")
#Limit the length of our history:
var max_scroll_length := 0
onready var history_rows = $Background/MarginContainer/Rows/GameInfo/ScrollContainer/HistoryRows
onready var scroll = $Background/MarginContainer/Rows/GameInfo/ScrollContainer
onready var scrollbar = scroll.get_v_scrollbar()
#Ensure that the latest added input is in focus on scroll
func _ready() -> void:
scrollbar.connect("changed", self, "handle_scrollbar_changed")
max_scroll_length = scrollbar.max_value
func handle_scrollbar_changed():
if max_scroll_length != scrollbar.max_value:
max_scroll_length = scrollbar.max_value
scroll.scroll_vertical = max_scroll_length
#Below temporarily takes user selection and appends it to responses; adding new isntances
# of our input row with an input and response pair for each
func handleUserInput(user_choice: String) -> void:
var input_response = InputResponse.instance()
var inputText = "User selected: " + user_choice
var response = "Game text output for " + user_choice
input_response.set_text(inputText, response)
history_rows.add_child(input_response)
func _on_option1_button_down() -> void:
handleUserInput("Option 1")
func _on_option2_button_down() -> void:
handleUserInput("Option 2")
func _on_option3_button_down() -> void:
handleUserInput("Option 3")

View File

@ -0,0 +1,109 @@
[gd_scene load_steps=7 format=2]
[ext_resource path="res://UserInterface/But_ChangeScene.tscn" type="PackedScene" id=1]
[ext_resource path="res://Game.gd" type="Script" id=2]
[ext_resource path="res://assets/base_dynamicfont.tres" type="DynamicFont" id=3]
[sub_resource type="StyleBoxFlat" id=1]
bg_color = Color( 0.117647, 0.117647, 0.117647, 1 )
[sub_resource type="StyleBoxFlat" id=2]
bg_color = Color( 0.243137, 0.235294, 0.235294, 1 )
[sub_resource type="StyleBoxFlat" id=3]
bg_color = Color( 0.286275, 0.286275, 0.286275, 1 )
[node name="Game" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Background" type="PanelContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
custom_styles/panel = SubResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="MarginContainer" type="MarginContainer" parent="Background"]
margin_right = 1024.0
margin_bottom = 600.0
custom_constants/margin_right = 20
custom_constants/margin_top = 10
custom_constants/margin_left = 20
custom_constants/margin_bottom = 20
[node name="Rows" type="VBoxContainer" parent="Background/MarginContainer"]
margin_left = 20.0
margin_top = 10.0
margin_right = 1004.0
margin_bottom = 580.0
custom_constants/separation = 10
[node name="ItemList" type="ItemList" parent="Background/MarginContainer/Rows"]
margin_right = 984.0
margin_bottom = 40.0
rect_min_size = Vector2( 0, 40 )
[node name="But_ChangeScene" parent="Background/MarginContainer/Rows/ItemList" instance=ExtResource( 1 )]
margin_right = 82.0
margin_bottom = 30.0
text = "Menu"
next_scene_path = "res://Screens/MenuScreen.tscn"
[node name="GameInfo" type="PanelContainer" parent="Background/MarginContainer/Rows"]
margin_top = 50.0
margin_right = 984.0
margin_bottom = 436.0
size_flags_vertical = 3
custom_styles/panel = SubResource( 2 )
[node name="ScrollContainer" type="ScrollContainer" parent="Background/MarginContainer/Rows/GameInfo"]
margin_right = 984.0
margin_bottom = 386.0
scroll_horizontal_enabled = false
[node name="HistoryRows" type="VBoxContainer" parent="Background/MarginContainer/Rows/GameInfo/ScrollContainer"]
custom_constants/separation = 20
[node name="InputArea" type="PanelContainer" parent="Background/MarginContainer/Rows"]
margin_top = 446.0
margin_right = 984.0
margin_bottom = 570.0
rect_min_size = Vector2( 0, 120 )
custom_styles/panel = SubResource( 3 )
[node name="VBoxContainer" type="VBoxContainer" parent="Background/MarginContainer/Rows/InputArea"]
margin_right = 984.0
margin_bottom = 124.0
custom_constants/separation = 5
[node name="option1" type="LinkButton" parent="Background/MarginContainer/Rows/InputArea/VBoxContainer"]
margin_right = 984.0
margin_bottom = 38.0
custom_fonts/font = ExtResource( 3 )
text = "Option 1"
[node name="option2" type="LinkButton" parent="Background/MarginContainer/Rows/InputArea/VBoxContainer"]
margin_top = 43.0
margin_right = 984.0
margin_bottom = 81.0
focus_mode = 2
custom_fonts/font = ExtResource( 3 )
text = "Option 2"
[node name="option3" type="LinkButton" parent="Background/MarginContainer/Rows/InputArea/VBoxContainer"]
margin_top = 86.0
margin_right = 984.0
margin_bottom = 124.0
focus_mode = 2
custom_fonts/font = ExtResource( 3 )
text = "Option 3"
[connection signal="button_down" from="Background/MarginContainer/Rows/InputArea/VBoxContainer/option1" to="." method="_on_option1_button_down"]
[connection signal="button_down" from="Background/MarginContainer/Rows/InputArea/VBoxContainer/option2" to="." method="_on_option2_button_down"]
[connection signal="button_down" from="Background/MarginContainer/Rows/InputArea/VBoxContainer/option3" to="." method="_on_option3_button_down"]

View File

@ -0,0 +1,25 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://UserInterface/Title.tscn" type="PackedScene" id=1]
[ext_resource path="res://UserInterface/But_ChangeScene.tscn" type="PackedScene" id=2]
[node name="Control" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Title" parent="." instance=ExtResource( 1 )]
anchor_left = 0.0
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 0.0
margin_top = 0.0
margin_right = 0.0
margin_bottom = 0.0
text = "Add Character (temp)"
[node name="But_ChangeScene" parent="Title" instance=ExtResource( 2 )]
text = "Temp: back to menu"
next_scene_path = "res://Screens/MenuScreen.tscn"

View File

@ -0,0 +1,13 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://UserInterface/Title.tscn" type="PackedScene" id=1]
[node name="Control" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Title" parent="." instance=ExtResource( 1 )]
text = "Load game (temp)"

View File

@ -0,0 +1,94 @@
[gd_scene load_steps=7 format=2]
[ext_resource path="res://UserInterface/But_ChangeScene.tscn" type="PackedScene" id=1]
[ext_resource path="res://UserInterface/Title.tscn" type="PackedScene" id=5]
[ext_resource path="res://assets/background_demo.png" type="Texture" id=7]
[ext_resource path="res://assets/ui_theme.tres" type="Theme" id=8]
[ext_resource path="res://assets/ui_title_theme.tres" type="Theme" id=9]
[ext_resource path="res://UserInterface/But_Quit.tscn" type="PackedScene" id=10]
[node name="MenuScreen" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
theme = ExtResource( 8 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="background_demo" type="TextureRect" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
texture = ExtResource( 7 )
expand = true
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Title" parent="." instance=ExtResource( 5 )]
margin_top = 51.8676
margin_bottom = 117.868
theme = ExtResource( 9 )
[node name="VBoxContainer" type="VBoxContainer" parent="."]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -119.0
margin_top = -152.0
margin_right = 119.0
margin_bottom = 152.0
rect_scale = Vector2( 1.04675, 1.07389 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="But_NewGame" parent="VBoxContainer" instance=ExtResource( 1 )]
margin_right = 238.0
margin_bottom = 48.0
next_scene_path = "res://Game.tscn"
[node name="But_LoadGame" parent="VBoxContainer" instance=ExtResource( 1 )]
margin_top = 52.0
margin_right = 238.0
margin_bottom = 100.0
text = "Load Game"
next_scene_path = "res://Game.tscn"
[node name="But_Multiplayer" parent="VBoxContainer" instance=ExtResource( 1 )]
margin_top = 104.0
margin_right = 238.0
margin_bottom = 152.0
text = "Multiplayer"
next_scene_path = "res://Screens/Multiplayer_temp.tscn"
[node name="But_AddChar" parent="VBoxContainer" instance=ExtResource( 1 )]
margin_top = 156.0
margin_right = 238.0
margin_bottom = 204.0
text = "Add Character"
next_scene_path = "res://Screens/AddCharacter_temp.tscn"
[node name="But_Settings" parent="VBoxContainer" instance=ExtResource( 1 )]
margin_top = 208.0
margin_right = 238.0
margin_bottom = 256.0
text = "Settings"
next_scene_path = "res://Screens/Settings.tscn"
[node name="But_Quit" parent="VBoxContainer" instance=ExtResource( 10 )]
margin_top = 260.0
margin_right = 238.0
margin_bottom = 304.0
[node name="Version" type="Label" parent="."]
anchor_left = 1.0
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = -165.0
margin_top = -38.0
text = "Version: 0.0.0"
__meta__ = {
"_edit_use_anchors_": false
}

View File

@ -0,0 +1,25 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://UserInterface/Title.tscn" type="PackedScene" id=1]
[ext_resource path="res://UserInterface/But_ChangeScene.tscn" type="PackedScene" id=2]
[node name="Control" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Title" parent="." instance=ExtResource( 1 )]
anchor_left = 0.0
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 0.0
margin_top = 0.0
margin_right = 0.0
margin_bottom = 0.0
text = "Multiplayer (temp)"
[node name="But_ChangeScene" parent="Title" instance=ExtResource( 2 )]
text = "Temp: back to menu"
next_scene_path = "res://Screens/MenuScreen.tscn"

View File

@ -0,0 +1,13 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://UserInterface/Title.tscn" type="PackedScene" id=1]
[node name="Control" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="newGameTextTemp" parent="." instance=ExtResource( 1 )]
text = "Start new game (temp)"

View File

@ -0,0 +1,130 @@
[gd_scene load_steps=10 format=2]
[ext_resource path="res://UserInterface/Title.tscn" type="PackedScene" id=1]
[ext_resource path="res://assets/background_demo.png" type="Texture" id=2]
[ext_resource path="res://assets/ui_theme.tres" type="Theme" id=3]
[ext_resource path="res://assets/ui_title_theme.tres" type="Theme" id=4]
[ext_resource path="res://UserInterface/But_ChangeScene.tscn" type="PackedScene" id=5]
[ext_resource path="res://Screens/inputText.gd" type="Script" id=6]
[ext_resource path="res://assets/base_dynamicfont.tres" type="DynamicFont" id=7]
[ext_resource path="res://UserInterface/But_SaveSettings.gd" type="Script" id=8]
[ext_resource path="res://Screens/SettingsInitialize.gd" type="Script" id=9]
[node name="SettingsScreen" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
theme = ExtResource( 3 )
script = ExtResource( 9 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="background_demo" type="TextureRect" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
texture = ExtResource( 2 )
expand = true
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Title" parent="." instance=ExtResource( 1 )]
anchor_left = 0.0
anchor_right = 0.0
margin_left = 0.0
margin_top = 0.0
margin_right = 296.0
margin_bottom = 135.0
theme = ExtResource( 4 )
text = " Player Settings
"
[node name="Hbox_buttons" type="HBoxContainer" parent="."]
anchor_left = 1.0
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = -426.0
margin_top = -67.0
grow_vertical = 0
rect_scale = Vector2( 1.04675, 1.07389 )
alignment = 2
__meta__ = {
"_edit_use_anchors_": false
}
[node name="But_SaveSettings" parent="Hbox_buttons" instance=ExtResource( 5 )]
margin_right = 164.0
margin_bottom = 67.0
text = "Save Settings"
script = ExtResource( 8 )
next_scene_path = "res://Screens/MenuScreen.tscn"
[node name="But_CloseWithoutSaving" parent="Hbox_buttons" instance=ExtResource( 5 )]
margin_left = 168.0
margin_right = 426.0
margin_bottom = 67.0
grow_horizontal = 0
grow_vertical = 0
text = "Close Without Saving"
next_scene_path = "res://Screens/MenuScreen.tscn"
[node name="VBoxContainer" type="VBoxContainer" parent="."]
anchor_top = 0.5
anchor_bottom = 0.5
margin_top = -187.879
margin_right = 605.0
margin_bottom = -115.879
__meta__ = {
"_edit_use_anchors_": false
}
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
margin_right = 605.0
margin_bottom = 48.0
[node name="label_disName" type="Label" parent="VBoxContainer/HBoxContainer"]
margin_top = 5.0
margin_right = 175.0
margin_bottom = 43.0
size_flags_horizontal = 2
text = "Display Name: "
__meta__ = {
"_edit_use_anchors_": false
}
[node name="input_name" type="LineEdit" parent="VBoxContainer/HBoxContainer"]
margin_left = 304.0
margin_right = 605.0
margin_bottom = 48.0
size_flags_horizontal = 3
custom_fonts/font = ExtResource( 7 )
max_length = 48
script = ExtResource( 6 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer"]
margin_top = 52.0
margin_right = 605.0
margin_bottom = 100.0
[node name="label_risk" type="Label" parent="VBoxContainer/HBoxContainer2"]
margin_top = 5.0
margin_right = 300.0
margin_bottom = 43.0
size_flags_horizontal = 3
text = "Risk Factor Threshold: "
__meta__ = {
"_edit_use_anchors_": false
}
[node name="input_risk" type="LineEdit" parent="VBoxContainer/HBoxContainer2"]
margin_left = 304.0
margin_right = 605.0
margin_bottom = 48.0
size_flags_horizontal = 3
__meta__ = {
"_edit_use_anchors_": false
}

View File

@ -0,0 +1,12 @@
extends Control
onready var psCurrentSettings = get_node("/root/PlayerSettings")
func _ready() -> void:
var inputName = get_node("VBoxContainer/HBoxContainer/input_name")
var inputRisk = get_node("VBoxContainer/HBoxContainer2/input_risk")
inputName.text = psCurrentSettings.playerSettingsSingleton.inputName
inputRisk.text = psCurrentSettings.playerSettingsSingleton.riskFactor

View File

@ -0,0 +1,7 @@
extends LineEdit
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
grab_focus()

View File

@ -0,0 +1,15 @@
#Tool lets you any code in editor, such as plugins
tool
extends Button
#Creates param usable in the UI; and the params next to export make it string and file browser
export(String, FILE) var next_scene_path: = ""
func _on_But_NewGame_button_up():
get_tree().change_scene(next_scene_path)
func _get_configuration_warning() -> String:
return "next_scene_path must be set for this button to work" if next_scene_path == "" else ""

View File

@ -0,0 +1,15 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://UserInterface/But_ChangeScene.gd" type="Script" id=1]
[node name="But_ChangeScene" type="Button"]
margin_right = 130.0
margin_bottom = 24.0
size_flags_vertical = 3
text = "New Game"
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="button_up" from="." to="." method="_on_But_NewGame_button_up"]

View File

@ -0,0 +1,6 @@
extends Button
func _on_But_Quit_button_up():
get_tree().quit()

View File

@ -0,0 +1,15 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://UserInterface/But_Quit.gd" type="Script" id=1]
[node name="But_Quit" type="Button"]
margin_top = 240.0
margin_right = 179.0
margin_bottom = 284.0
text = "Quit"
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="button_up" from="." to="." method="_on_But_Quit_button_up"]

View File

@ -0,0 +1,64 @@
#Script for settings save button
#Tool lets you any code in editor, such as plugins
tool
extends Button
#Creates param usable in the UI; and the params next to export make it string and file browser
export(String, FILE) var next_scene_path: = ""
#Button response: save settings and move on.
func _on_But_NewGame_button_up():
var inputName = get_node("../../VBoxContainer/HBoxContainer/input_name")
var inputRisk = get_node("../../VBoxContainer/HBoxContainer2/input_risk")
_saveSettings(inputName.text, inputRisk.text)
get_tree().change_scene(next_scene_path)
#HELPER FUNCTIONS:
func _get_configuration_warning() -> String:
return "next_scene_path must be set for this button to work" if next_scene_path == "" else ""
func _saveSettings(inputSettings : String, riskFactor : String) -> void:
var player_settings = get_node("/root/PlayerSettings")
player_settings.playerSettingsSingleton.inputName = inputSettings
player_settings.playerSettingsSingleton.riskFactor = riskFactor
#Temp:
var temp_manual_JSON = {
"playerSettingsTemplate": {
"inputName": inputSettings,
"riskFactor": riskFactor
}
}
#Save to file (JSON for now)
var settings_file = "user://testPlayerSettings.sav"
var file = File.new()
if file.open(settings_file, File.WRITE) != 0:
print("Cannot write temporary file to: " + settings_file)
else:
file.store_line(to_json(temp_manual_JSON))
file.close()
#****This save Settings functions as designed; but modified to work with alternate approach of loading
#func _saveSettings(inputSettings : String, riskFactor : String) -> void:
#Debugging:
# print("Input name: " + inputSettings + "; and risk factor set to : " + riskFactor)
# var player_settings = get_node("/root/PlayerSettings")
# player_settings.playerSettingsSingleton.inputName = inputSettings
# player_settings.playerSettingsSingleton.riskFactor = riskFactor
#Save to file (for now)
# if settings_save_file_name == "":
# settings_save_file_name = "settings.save"
# var settings_file = "user://" + settings_save_file_name
# var file = File.new()
# file.open(settings_file, File.WRITE)
# file.store_var(player_settings.playerSettingsSingleton.inputName)
#DKM TEMP: To save object; removed for testing
#file.store_var(player_settings.playerSettingsSingleton, true)
# file.close()

View File

@ -0,0 +1,5 @@
extends VBoxContainer
func set_text(input: String, response: String):
$InputHistory.text = input
$Response.text = response

View File

@ -0,0 +1,27 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://assets/base_dynamicfont_16.tres" type="DynamicFont" id=1]
[ext_resource path="res://assets/base_dynamicfont.tres" type="DynamicFont" id=2]
[ext_resource path="res://UserInterface/InputResponse.gd" type="Script" id=3]
[node name="InputResponse" type="VBoxContainer"]
margin_right = 984.0
margin_bottom = 68.0
script = ExtResource( 3 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="InputHistory" type="Label" parent="."]
margin_right = 984.0
margin_bottom = 26.0
custom_fonts/font = ExtResource( 1 )
custom_colors/font_color = Color( 0.686275, 0.658824, 0.658824, 1 )
text = " > This is what user selected"
[node name="Response" type="Label" parent="."]
margin_top = 30.0
margin_right = 984.0
margin_bottom = 68.0
custom_fonts/font = ExtResource( 2 )
text = "Game text continues here... "

View File

@ -0,0 +1,17 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://assets/base_dynamicFont_BIG.tres" type="DynamicFont" id=1]
[node name="Title" type="Label"]
anchor_left = 0.5
anchor_right = 0.5
margin_left = -110.5
margin_top = 114.422
margin_right = 110.5
margin_bottom = 180.422
custom_fonts/font = ExtResource( 1 )
text = "Main Menu"
align = 1
__meta__ = {
"_edit_use_anchors_": false
}

View File

@ -0,0 +1,11 @@
[gd_scene format=2]
[node name="But_AddChar" type="Button"]
margin_top = 85.0
margin_right = 130.0
margin_bottom = 109.0
size_flags_vertical = 3
text = "Add Character"
__meta__ = {
"_edit_use_anchors_": false
}

View File

@ -0,0 +1,8 @@
[gd_scene format=2]
[node name="But_LoadGame" type="Button"]
margin_top = 28.0
margin_right = 130.0
margin_bottom = 52.0
size_flags_vertical = 3
text = "Load Game"

View File

@ -0,0 +1,11 @@
[gd_scene format=2]
[node name="But_Multiplayer" type="Button"]
margin_top = 56.0
margin_right = 130.0
margin_bottom = 81.0
size_flags_vertical = 3
text = "Multiplayer"
__meta__ = {
"_edit_use_anchors_": false
}

View File

@ -0,0 +1,8 @@
[gd_scene format=2]
[node name="But_Settings" type="Button"]
margin_top = 113.0
margin_right = 130.0
margin_bottom = 138.0
size_flags_vertical = 3
text = "Settings"

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/background_demo.png-bf78baa5e40d24f1836aa08964398dec.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/background_demo.png"
dest_files=[ "res://.import/background_demo.png-bf78baa5e40d24f1836aa08964398dec.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View File

@ -0,0 +1,7 @@
[gd_resource type="DynamicFont" load_steps=2 format=2]
[ext_resource path="res://assets/l_10646.ttf" type="DynamicFontData" id=1]
[resource]
size = 42
font_data = ExtResource( 1 )

View File

@ -0,0 +1,7 @@
[gd_resource type="DynamicFont" load_steps=2 format=2]
[ext_resource path="res://assets/l_10646.ttf" type="DynamicFontData" id=1]
[resource]
size = 24
font_data = ExtResource( 1 )

View File

@ -0,0 +1,6 @@
[gd_resource type="DynamicFont" load_steps=2 format=2]
[ext_resource path="res://assets/l_10646.ttf" type="DynamicFontData" id=1]
[resource]
font_data = ExtResource( 1 )

View File

@ -0,0 +1,6 @@
[gd_resource type="Theme" load_steps=2 format=2]
[ext_resource path="res://assets/base_dynamicfont.tres" type="DynamicFont" id=1]
[resource]
default_font = ExtResource( 1 )

View File

@ -0,0 +1,6 @@
[gd_resource type="Theme" load_steps=2 format=2]
[ext_resource path="res://assets/base_dynamicFont_BIG.tres" type="DynamicFont" id=1]
[resource]
default_font = ExtResource( 1 )

View File

@ -0,0 +1,7 @@
[gd_resource type="Environment" load_steps=2 format=2]
[sub_resource type="ProceduralSky" id=1]
[resource]
background_mode = 2
background_sky = SubResource( 1 )

View File

@ -0,0 +1,38 @@
#***PLAYER SETTINGS: a singleton to hold settings in-game. Currently for test
# purposes, initializes a playerSettingsTemplate class, and attempts to
# load in a saved player settings file. This then updates the singleton.
extends Node
var settings_file = "user://testPlayerSettings.sav"
var playerSettingsSingleton = PlayerSettingsTemplate.new()
func _ready() -> void:
load_settings_file()
#Using JSON:
#DKM TEMP: manual JSON parsing is most certainly not the way to go -- temp testing these
# are saved and loaded correctly.
func load_settings_file():
var file = File.new()
file.open(settings_file, file.READ)
var text = file.get_as_text()
var parsedText = parse_json(text)
if(parsedText != null):
print("Input name loaded as: " + parsedText.playerSettingsTemplate.inputName)
playerSettingsSingleton.inputName = parsedText.playerSettingsTemplate.inputName
playerSettingsSingleton.riskFactor = parsedText.playerSettingsTemplate.riskFactor
else:
print("No previously existing player settings file found")
#DKM TEMP:
#****THIS LOADS a string successfully, but not objects
#func _loadSettings() -> void:
#DKM TEMP: we cannot hard code this here and allow user access on But_SaveS UI
# var settings_file = "user://testSettings"
# var file = File.new()
# if file.file_exists(settings_file):
# file.open(settings_file, File.READ)
# playerSettingsSingleton.inputName = file.get_var()
# file.close()
# print("name found as: " + playerSettingsSingleton.inputName)

View File

@ -0,0 +1,5 @@
extends Node
class_name PlayerSettingsTemplate
var inputName = "None"
var riskFactor = "0"

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.png"
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View File

@ -0,0 +1,37 @@
; Engine configuration file.
; It's best edited using the editor UI and not directly,
; since the parameters that go here are not all obvious.
;
; Format:
; [section] ; section goes between []
; param=value ; assign values to parameters
config_version=4
_global_script_classes=[ {
"base": "Node",
"class": "PlayerSettingsTemplate",
"language": "GDScript",
"path": "res://globalScripts/playerSettingsTemplate.gd"
} ]
_global_script_class_icons={
"PlayerSettingsTemplate": ""
}
[application]
config/name="RPGR_moduleWork_21_1114A"
run/main_scene="res://Screens/MenuScreen.tscn"
config/icon="res://icon.png"
[autoload]
PlayerSettings="*res://globalScripts/playerSettings.gd"
[physics]
common/enable_pause_aware_picking=true
[rendering]
environment/default_environment="res://default_env.tres"

View File

@ -0,0 +1,3 @@
source_md5="266f789a4e895911161321092c2c2429"
dest_md5="a08a6dcf169f683724bfd5cd82e23fe6"

View File

@ -0,0 +1,3 @@
source_md5="47313fa4c47a9963fddd764e1ec6e4a8"
dest_md5="2ded9e7f9060e2b530aab678b135fc5b"

Some files were not shown because too many files have changed in this diff Show More