Merge branch 'master' of github.com:unfa/jam-01 into master
commit
e02243699f
|
@ -3,5 +3,8 @@
|
|||
[ext_resource path="res://Fonts/Roboto_Condensed/RobotoCondensed-Regular.tres" type="DynamicFontData" id=1]
|
||||
|
||||
[resource]
|
||||
size = 48
|
||||
size = 32
|
||||
outline_size = 2
|
||||
outline_color = Color( 0.156863, 0.156863, 0.156863, 1 )
|
||||
use_mipmaps = true
|
||||
font_data = ExtResource( 1 )
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
[gd_resource type="Theme" load_steps=7 format=2]
|
||||
|
||||
[ext_resource path="res://Fonts/Roboto_Condensed/RobotoCondensed-Regular-dynamic.tres" type="DynamicFont" id=1]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=2]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=3]
|
||||
bg_color = Color( 0.113725, 0.0784314, 0.0392157, 0.513726 )
|
||||
corner_radius_top_left = 5
|
||||
corner_radius_top_right = 5
|
||||
corner_radius_bottom_right = 5
|
||||
corner_radius_bottom_left = 5
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=1]
|
||||
bg_color = Color( 0.172549, 0.109804, 0.109804, 0.372549 )
|
||||
border_width_left = 5
|
||||
border_width_top = 5
|
||||
border_width_right = 5
|
||||
border_width_bottom = 5
|
||||
border_color = Color( 0, 0, 0, 1 )
|
||||
border_blend = true
|
||||
corner_radius_top_left = 5
|
||||
corner_radius_top_right = 5
|
||||
corner_radius_bottom_right = 5
|
||||
corner_radius_bottom_left = 5
|
||||
corner_detail = 5
|
||||
shadow_color = Color( 0.113725, 0.0862745, 0.0235294, 0.6 )
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=4]
|
||||
bg_color = Color( 0.168627, 0.105882, 0.0470588, 0.611765 )
|
||||
corner_radius_top_left = 5
|
||||
corner_radius_top_right = 5
|
||||
corner_radius_bottom_right = 5
|
||||
corner_radius_bottom_left = 5
|
||||
shadow_size = 1
|
||||
shadow_offset = Vector2( 2, 2 )
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=5]
|
||||
bg_color = Color( 0.172549, 0.109804, 0.109804, 0.372549 )
|
||||
border_width_left = 5
|
||||
border_width_top = 5
|
||||
border_width_right = 5
|
||||
border_width_bottom = 5
|
||||
border_color = Color( 0, 0, 0, 1 )
|
||||
border_blend = true
|
||||
corner_radius_top_left = 5
|
||||
corner_radius_top_right = 5
|
||||
corner_radius_bottom_right = 5
|
||||
corner_radius_bottom_left = 5
|
||||
|
||||
[resource]
|
||||
default_font = ExtResource( 1 )
|
||||
Button/colors/font_color = Color( 0.88, 0.88, 0.88, 1 )
|
||||
Button/colors/font_color_disabled = Color( 0.9, 0.9, 0.9, 0.2 )
|
||||
Button/colors/font_color_hover = Color( 0.94, 0.94, 0.94, 1 )
|
||||
Button/colors/font_color_pressed = Color( 1, 1, 1, 1 )
|
||||
Button/constants/hseparation = 2
|
||||
Button/fonts/font = null
|
||||
Button/styles/disabled = null
|
||||
Button/styles/focus = SubResource( 2 )
|
||||
Button/styles/hover = SubResource( 3 )
|
||||
Button/styles/normal = SubResource( 1 )
|
||||
Button/styles/pressed = SubResource( 4 )
|
||||
LineEdit/colors/clear_button_color = Color( 0.88, 0.88, 0.88, 1 )
|
||||
LineEdit/colors/clear_button_color_pressed = Color( 1, 1, 1, 1 )
|
||||
LineEdit/colors/cursor_color = Color( 0.94, 0.94, 0.94, 1 )
|
||||
LineEdit/colors/font_color = Color( 0.88, 0.88, 0.88, 1 )
|
||||
LineEdit/colors/font_color_selected = Color( 0, 0, 0, 1 )
|
||||
LineEdit/colors/font_color_uneditable = Color( 0.88, 0.88, 0.88, 0.5 )
|
||||
LineEdit/colors/selection_color = Color( 0.49, 0.49, 0.49, 1 )
|
||||
LineEdit/constants/minimum_spaces = 12
|
||||
LineEdit/fonts/font = null
|
||||
LineEdit/icons/clear = null
|
||||
LineEdit/styles/focus = null
|
||||
LineEdit/styles/normal = SubResource( 5 )
|
||||
LineEdit/styles/read_only = null
|
21
Game.gd
21
Game.gd
|
@ -12,12 +12,12 @@ var player_scene = preload("res://Player.tscn")
|
|||
|
||||
var settingmap = {
|
||||
"is_fullscreen": "set_fullscreen",
|
||||
"mouse_sensitivity": "set_mouse_sensitivity"
|
||||
"mouse_sensitivity": "set_mouse_sensitivity",
|
||||
"nickname": "set_nickname"
|
||||
}
|
||||
|
||||
onready var peer = NetworkedMultiplayerENet.new()
|
||||
var local_player = null setget set_local_player
|
||||
var player_name = "guest"
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
|
@ -147,6 +147,12 @@ func set_fullscreen(is_fullscreen, save=true):
|
|||
else:
|
||||
$MenuContainer/GraphicsMenu/Fullscreen.pressed = is_fullscreen
|
||||
|
||||
func set_nickname(nickname, save=true):
|
||||
if save:
|
||||
save_setting("nickname", nickname)
|
||||
else:
|
||||
$MenuContainer/MainMenu/Name.text = nickname
|
||||
|
||||
func debug_connection_status():
|
||||
if (get_tree().network_peer.get_connection_status() == NetworkedMultiplayerPeer.CONNECTION_CONNECTING):
|
||||
print("We are trying to connect")
|
||||
|
@ -161,13 +167,8 @@ func initialize_server(join=true):
|
|||
peer.create_server(SERVER_PORT, MAX_PLAYERS)
|
||||
get_tree().connect("network_peer_connected", self, "on_peer_connected")
|
||||
get_tree().connect("network_peer_disconnected", self, "on_peer_disconnected")
|
||||
get_tree().network_peer = peer
|
||||
|
||||
$MenuContainer/MainMenu/Connect.hide()
|
||||
$MenuContainer/MainMenu/Disconnect.show()
|
||||
close_menus()
|
||||
|
||||
print(get_tree().get_network_unique_id())
|
||||
initialize()
|
||||
|
||||
if join:
|
||||
add_player(1, false)
|
||||
|
@ -178,12 +179,16 @@ func initialize_client():
|
|||
get_tree().connect("connection_failed", self, "on_connection_failed")
|
||||
get_tree().network_peer = peer
|
||||
|
||||
initialize()
|
||||
|
||||
func initialize():
|
||||
return_to_menu("MainMenu")
|
||||
|
||||
$MenuContainer/MainMenu/Connect.hide()
|
||||
$MenuContainer/MainMenu/Disconnect.show()
|
||||
|
||||
close_menus()
|
||||
set_nickname($MenuContainer/MainMenu/Name.text)
|
||||
|
||||
func free_client():
|
||||
$MenuContainer/MainMenu/Connect.show()
|
||||
|
|
42
Game.tscn
42
Game.tscn
|
@ -1,5 +1,6 @@
|
|||
[gd_scene load_steps=5 format=2]
|
||||
[gd_scene load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://GUI/theme.tres" type="Theme" id=1]
|
||||
[ext_resource path="res://Game.gd" type="Script" id=2]
|
||||
[ext_resource path="res://Level.tscn" type="PackedScene" id=3]
|
||||
|
||||
|
@ -50,33 +51,34 @@ anchor_right = 1.0
|
|||
anchor_bottom = 1.0
|
||||
margin_left = -0.943848
|
||||
margin_right = -0.943848
|
||||
theme = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="MainMenu" type="VBoxContainer" parent="MenuContainer"]
|
||||
margin_left = 312.0
|
||||
margin_top = 230.0
|
||||
margin_top = 172.0
|
||||
margin_right = 712.0
|
||||
margin_bottom = 370.0
|
||||
margin_bottom = 428.0
|
||||
rect_min_size = Vector2( 400, 0 )
|
||||
|
||||
[node name="Name" type="LineEdit" parent="MenuContainer/MainMenu"]
|
||||
margin_right = 400.0
|
||||
margin_bottom = 24.0
|
||||
margin_bottom = 48.0
|
||||
placeholder_text = "Enter your name"
|
||||
|
||||
[node name="QuickConnect" type="Button" parent="MenuContainer/MainMenu"]
|
||||
margin_top = 28.0
|
||||
margin_top = 52.0
|
||||
margin_right = 400.0
|
||||
margin_bottom = 68.0
|
||||
margin_bottom = 100.0
|
||||
rect_min_size = Vector2( 0, 40 )
|
||||
text = "Quick Connect!"
|
||||
|
||||
[node name="Connect" type="Button" parent="MenuContainer/MainMenu"]
|
||||
margin_top = 72.0
|
||||
margin_top = 104.0
|
||||
margin_right = 400.0
|
||||
margin_bottom = 92.0
|
||||
margin_bottom = 152.0
|
||||
text = "Connect"
|
||||
|
||||
[node name="Disconnect" type="Button" parent="MenuContainer/MainMenu"]
|
||||
|
@ -87,23 +89,23 @@ margin_bottom = 44.0
|
|||
text = "Disconnect"
|
||||
|
||||
[node name="Options" type="Button" parent="MenuContainer/MainMenu"]
|
||||
margin_top = 96.0
|
||||
margin_top = 156.0
|
||||
margin_right = 400.0
|
||||
margin_bottom = 116.0
|
||||
margin_bottom = 204.0
|
||||
text = "Options"
|
||||
|
||||
[node name="Quit" type="Button" parent="MenuContainer/MainMenu"]
|
||||
margin_top = 120.0
|
||||
margin_top = 208.0
|
||||
margin_right = 400.0
|
||||
margin_bottom = 140.0
|
||||
margin_bottom = 256.0
|
||||
text = "Quit"
|
||||
|
||||
[node name="ConnectMenu" type="VBoxContainer" parent="MenuContainer"]
|
||||
visible = false
|
||||
margin_left = 312.0
|
||||
margin_top = 224.0
|
||||
margin_top = 142.0
|
||||
margin_right = 712.0
|
||||
margin_bottom = 376.0
|
||||
margin_bottom = 458.0
|
||||
rect_min_size = Vector2( 400, 0 )
|
||||
|
||||
[node name="Back" type="Button" parent="MenuContainer/ConnectMenu"]
|
||||
|
@ -184,9 +186,9 @@ text = "Jan"
|
|||
[node name="OptionsMenu" type="VBoxContainer" parent="MenuContainer"]
|
||||
visible = false
|
||||
margin_left = 312.0
|
||||
margin_top = 266.0
|
||||
margin_top = 224.0
|
||||
margin_right = 712.0
|
||||
margin_bottom = 334.0
|
||||
margin_bottom = 376.0
|
||||
rect_min_size = Vector2( 400, 0 )
|
||||
|
||||
[node name="Back" type="Button" parent="MenuContainer/OptionsMenu"]
|
||||
|
@ -213,9 +215,9 @@ text = "Graphics"
|
|||
[node name="ControlsMenu" type="VBoxContainer" parent="MenuContainer"]
|
||||
visible = false
|
||||
margin_left = 312.0
|
||||
margin_top = 280.0
|
||||
margin_top = 255.0
|
||||
margin_right = 712.0
|
||||
margin_bottom = 320.0
|
||||
margin_bottom = 345.0
|
||||
rect_min_size = Vector2( 400, 0 )
|
||||
|
||||
[node name="Back" type="Button" parent="MenuContainer/ControlsMenu"]
|
||||
|
@ -247,9 +249,9 @@ allow_lesser = true
|
|||
[node name="GraphicsMenu" type="VBoxContainer" parent="MenuContainer"]
|
||||
visible = false
|
||||
margin_left = 312.0
|
||||
margin_top = 268.0
|
||||
margin_top = 250.0
|
||||
margin_right = 712.0
|
||||
margin_bottom = 332.0
|
||||
margin_bottom = 350.0
|
||||
rect_min_size = Vector2( 400, 0 )
|
||||
|
||||
[node name="Back" type="Button" parent="MenuContainer/GraphicsMenu"]
|
||||
|
|
Reference in New Issue