mirror of
https://github.com/kristoferssolo/FuncIt.git
synced 2025-10-21 19:30:35 +00:00
Singleplayer test
This commit is contained in:
parent
5231ce8624
commit
ce76a57956
@ -72,6 +72,7 @@ func _player_disconnected(id) -> void:
|
||||
PersistentNodes.get_node(str(id)).username_text_instance.queue_free()
|
||||
PersistentNodes.get_node(str(id)).queue_free()
|
||||
|
||||
|
||||
func _on_create_server_pressed():
|
||||
controls.hide()
|
||||
username.show()
|
||||
|
||||
@ -0,0 +1,48 @@
|
||||
extends Control
|
||||
|
||||
var player = load("res://source/entities/player/player_node.tscn")
|
||||
|
||||
onready var username_text_edit = $popup_screen/panel/username_text_edit
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
username_text_edit.call_deferred("grab_focus")
|
||||
|
||||
|
||||
func _process(delta) -> void:
|
||||
if Input.is_action_just_pressed("esc"):
|
||||
get_tree().change_scene("res://source/scenes/GUI/main_menu.tscn")
|
||||
|
||||
|
||||
#func _player_connected(id) -> void:
|
||||
# print("Player " + str(id) + " has connected")
|
||||
#
|
||||
#
|
||||
#func _connected_to_server() -> void:
|
||||
# yield(get_tree().create_timer(0.1), "timeout")
|
||||
#
|
||||
#
|
||||
#func _on_start_game_pressed():
|
||||
# rpc("switch_to_game")
|
||||
|
||||
|
||||
func _on_confirm_pressed():
|
||||
if username_text_edit.text != "":
|
||||
Network.current_player_username = username_text_edit.text
|
||||
Network.create_server()
|
||||
rpc("switch_to_game")
|
||||
|
||||
|
||||
sync func switch_to_game() -> void:
|
||||
for child in PersistentNodes.get_children():
|
||||
if child.is_in_group("Player"):
|
||||
child.update_shoot_mode(true)
|
||||
|
||||
get_tree().change_scene("res://source/levels/trinity_site/trinity_site_level.tscn")
|
||||
|
||||
|
||||
|
||||
|
||||
func _on_return_pressed():
|
||||
get_tree().change_scene("res://source/scenes/GUI/main_menu.tscn")
|
||||
|
||||
@ -2,8 +2,7 @@ extends Control
|
||||
|
||||
|
||||
func _on_play_pressed():
|
||||
#get_tree().change_scene("res://source/levels/trinity_site/trinity_site_level.tscn")
|
||||
pass
|
||||
get_tree().change_scene("res://source/scenes/GUI/sinplayer_setup.tscn")
|
||||
|
||||
|
||||
func _on_LAN_party_pressed():
|
||||
|
||||
129
source/scenes/GUI/sinplayer_setup.tscn
Normal file
129
source/scenes/GUI/sinplayer_setup.tscn
Normal file
@ -0,0 +1,129 @@
|
||||
[gd_scene load_steps=11 format=2]
|
||||
|
||||
[ext_resource path="res://source/assets/scripts/server_handlers/network_processors/singleplayer_setup.gd" type="Script" id=1]
|
||||
[ext_resource path="res://source/fonts/oxygen/Oxygen-Regular.ttf" type="DynamicFontData" id=2]
|
||||
[ext_resource path="res://source/scenes/GUI/background.tscn" type="PackedScene" id=5]
|
||||
[ext_resource path="res://source/scenes/OVERLAY/elements/button.tscn" type="PackedScene" id=9]
|
||||
[ext_resource path="res://source/assets/sprites/GUI/server_title.svg" type="Texture" id=15]
|
||||
|
||||
[sub_resource type="DynamicFont" id=1]
|
||||
size = 36
|
||||
use_mipmaps = true
|
||||
use_filter = true
|
||||
font_data = ExtResource( 2 )
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id=2]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id=3]
|
||||
|
||||
[sub_resource type="DynamicFont" id=4]
|
||||
size = 36
|
||||
use_mipmaps = true
|
||||
use_filter = true
|
||||
font_data = ExtResource( 2 )
|
||||
|
||||
[sub_resource type="DynamicFont" id=5]
|
||||
size = 36
|
||||
use_mipmaps = true
|
||||
use_filter = true
|
||||
font_data = ExtResource( 2 )
|
||||
|
||||
[node name="network_setup" type="Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="background" parent="." instance=ExtResource( 5 )]
|
||||
|
||||
[node name="popup_screen" type="Control" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 2.5199
|
||||
margin_right = 2.5199
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="enter_server_ip" type="Sprite" parent="popup_screen"]
|
||||
position = Vector2( 960, 465 )
|
||||
texture = ExtResource( 15 )
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="Label" type="Label" parent="popup_screen/enter_server_ip"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = -225.0
|
||||
margin_top = -25.0
|
||||
margin_right = -225.0
|
||||
margin_bottom = -25.0
|
||||
custom_fonts/font = SubResource( 1 )
|
||||
custom_colors/font_color = Color( 0, 0, 0, 1 )
|
||||
text = "Enter your username"
|
||||
align = 1
|
||||
valign = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="panel" type="Panel" parent="popup_screen"]
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = -200.0
|
||||
margin_top = -50.0
|
||||
margin_right = 200.0
|
||||
margin_bottom = 50.0
|
||||
__meta__ = {
|
||||
"_edit_lock_": true,
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="username_text_edit" type="LineEdit" parent="popup_screen/panel"]
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = -175.0
|
||||
margin_top = -28.0
|
||||
margin_right = 175.0
|
||||
margin_bottom = 28.0
|
||||
custom_styles/focus = SubResource( 2 )
|
||||
custom_styles/normal = SubResource( 3 )
|
||||
custom_fonts/font = SubResource( 4 )
|
||||
custom_colors/selection_color = Color( 0.8, 0.8, 0.8, 1 )
|
||||
align = 1
|
||||
placeholder_text = "username"
|
||||
__meta__ = {
|
||||
"_edit_lock_": true,
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="confirm" parent="popup_screen/panel" instance=ExtResource( 9 )]
|
||||
anchor_left = 0.5
|
||||
anchor_top = 1.0
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
margin_left = -150.0
|
||||
margin_top = 25.0
|
||||
margin_right = 150.0
|
||||
margin_bottom = 97.0
|
||||
|
||||
[node name="Label" type="Label" parent="popup_screen/panel/confirm"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
custom_fonts/font = SubResource( 5 )
|
||||
custom_colors/font_color = Color( 0, 0, 0, 1 )
|
||||
text = "CONFIRM"
|
||||
align = 1
|
||||
valign = 1
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[connection signal="pressed" from="popup_screen/panel/confirm" to="." method="_on_confirm_pressed"]
|
||||
Loading…
Reference in New Issue
Block a user