beautify project

This commit is contained in:
Thorben 2020-05-15 10:51:54 +02:00
parent e28b8521d1
commit ccdbf5b158
8 changed files with 59 additions and 20 deletions

View File

@ -17,7 +17,6 @@ func initialize_connection():
_start_button.text = "Connecting..." _start_button.text = "Connecting..."
func connect_to_server(): func connect_to_server():
print("Try to join the server.")
var peer = NetworkedMultiplayerENet.new() var peer = NetworkedMultiplayerENet.new()
peer.create_client(SERVER_IP, SERVER_PORT) peer.create_client(SERVER_IP, SERVER_PORT)
get_tree().set_network_peer(peer) get_tree().set_network_peer(peer)

View File

@ -131,10 +131,6 @@ func try_to_occupy_hex(hex_node):
remote func occupy_hex(hex_x, hex_y): remote func occupy_hex(hex_x, hex_y):
_map._hexes[hex_x][hex_y].occupy_hex() _map._hexes[hex_x][hex_y].occupy_hex()
#func _process(delta):
# if len(_other_players) <= 0 and _game_started:
# end_game(true)
func left_game(): func left_game():
for player in _other_players: for player in _other_players:
rpc_id(player[0], "player_left", Player.get_player_id(), Player.get_player_name()) rpc_id(player[0], "player_left", Player.get_player_id(), Player.get_player_name())
@ -147,7 +143,6 @@ func end_game(is_winning):
$End_game_panel.visible = true $End_game_panel.visible = true
remote func player_left(player_id, player_name): remote func player_left(player_id, player_name):
print("Player: " + str(player_id) + " left.")
_other_players.erase([player_id, player_name]) _other_players.erase([player_id, player_name])
NetworkingSync._player_in_same_game_room_list.erase([player_id, player_name]) NetworkingSync._player_in_same_game_room_list.erase([player_id, player_name])
update_player_list() update_player_list()

View File

@ -13,13 +13,11 @@ func left_click_on_hex(hex_node):
if hex_node.is_free(): if hex_node.is_free():
if _game_manager.get_previous_hex() != null: if _game_manager.get_previous_hex() != null:
print("try to occupy")
if hex_node in _game_manager.get_previous_hex().get_neighbours(): if hex_node in _game_manager.get_previous_hex().get_neighbours():
print("Yea")
_game_manager.try_to_occupy_hex(hex_node) _game_manager.try_to_occupy_hex(hex_node)
else: else:
_game_manager.try_to_occupy_hex(hex_node) _game_manager.try_to_occupy_hex(hex_node)
func right_click_on_hex(hex_node): func right_click_on_hex(hex_node):
print("Right click") pass

View File

@ -58,7 +58,6 @@ func _on_Leave_button_pressed():
NetworkingSync.left_game() NetworkingSync.left_game()
yield(NetworkingSync, "updated_games") yield(NetworkingSync, "updated_games")
for player in NetworkingSync._open_games[Player.get_game_id()][3]: for player in NetworkingSync._open_games[Player.get_game_id()][3]:
print(player)
if player != Player.get_player_id(): if player != Player.get_player_id():
rpc_id(player, "update_game_room_player_list") rpc_id(player, "update_game_room_player_list")

View File

@ -3,7 +3,6 @@ extends Node
func _on_Button_pressed(): func _on_Button_pressed():
connect_to_server() connect_to_server()
func _on_LineEdit_text_changed(new_text): func _on_LineEdit_text_changed(new_text):
if len(new_text) <= 0 or len(new_text) >= 20: if len(new_text) <= 0 or len(new_text) >= 20:
$GUI/Start_button.disabled = true $GUI/Start_button.disabled = true

View File

@ -34,10 +34,6 @@ func left_game():
rpc_id(1, "remove_player_from_open_game", Player.get_game_id(), Player.get_player_id()) rpc_id(1, "remove_player_from_open_game", Player.get_game_id(), Player.get_player_id())
send_open_games_request_to_server() send_open_games_request_to_server()
func _on_Server_is_reachable_timeout():
print("Server is reachable.")
# TODO: check if connection still exists.
func close_game(): func close_game():
rpc_id(1, "remove_game_from_game_list", Player.get_game_id()) rpc_id(1, "remove_game_from_game_list", Player.get_game_id())

View File

@ -4,6 +4,3 @@
[node name="Networking" type="Node"] [node name="Networking" type="Node"]
script = ExtResource( 1 ) script = ExtResource( 1 )
[node name="Server_is_reachable_timer" type="Timer" parent="."]
[connection signal="timeout" from="Server_is_reachable_timer" to="." method="_on_Server_is_reachable_timeout"]

View File

@ -7,7 +7,7 @@ custom_features=""
export_filter="all_resources" export_filter="all_resources"
include_filter="" include_filter=""
exclude_filter="" exclude_filter=""
export_path="../../Godot_Executables/Client.x86_64" export_path="../../Godot_Executables/Client_linux/Client.x86_64"
patch_list=PoolStringArray( ) patch_list=PoolStringArray( )
script_export_mode=1 script_export_mode=1
script_encryption_key="" script_encryption_key=""
@ -33,7 +33,7 @@ custom_features=""
export_filter="all_resources" export_filter="all_resources"
include_filter="" include_filter=""
exclude_filter="" exclude_filter=""
export_path="../../Godot_Executables/Client.exe" export_path="../../Godot_Executables/Client_windows/Client.exe"
patch_list=PoolStringArray( ) patch_list=PoolStringArray( )
script_export_mode=1 script_export_mode=1
script_encryption_key="" script_encryption_key=""
@ -65,3 +65,59 @@ application/product_name=""
application/file_description="" application/file_description=""
application/copyright="" application/copyright=""
application/trademarks="" application/trademarks=""
[preset.2]
name="HTML5"
platform="HTML5"
runnable=true
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="../../Godot_Executables/Godot_client_web/Client_project.html"
patch_list=PoolStringArray( )
script_export_mode=1
script_encryption_key=""
[preset.2.options]
vram_texture_compression/for_desktop=true
vram_texture_compression/for_mobile=false
html/custom_html_shell=""
html/head_include=""
custom_template/release=""
custom_template/debug=""
[preset.3]
name="Mac OSX"
platform="Mac OSX"
runnable=true
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="../../Godot_Executables/Client_mac/Client.zip"
patch_list=PoolStringArray( )
script_export_mode=1
script_encryption_key=""
[preset.3.options]
custom_template/debug=""
custom_template/release=""
application/name=""
application/info="Made with Godot Engine"
application/icon=""
application/identifier=""
application/signature=""
application/short_version="1.0"
application/version="1.0"
application/copyright=""
display/high_res=false
privacy/camera_usage_description=""
privacy/microphone_usage_description=""
texture_format/s3tc=true
texture_format/etc=false
texture_format/etc2=false