Feature: inform when join room failed
This commit is contained in:
@@ -82,7 +82,13 @@ func on_join_request_completed(result, response_code, headers, body):
|
|||||||
ConnManager.connect_ws(Global.my_user_id)
|
ConnManager.connect_ws(Global.my_user_id)
|
||||||
else:
|
else:
|
||||||
var reason = res["reason"]
|
var reason = res["reason"]
|
||||||
print_debug("failed to join room")
|
print_debug("failed to join room, reason: ", reason)
|
||||||
|
if reason == Message.join_err.NO_SUCH_ROOM:
|
||||||
|
$NoSuchRoom.popup_centered()
|
||||||
|
elif reason == Message.join_err.NO_SEAT:
|
||||||
|
$NoSeat.popup_centered()
|
||||||
|
elif reason == Message.join_err.WRONG_PASSWORD:
|
||||||
|
$WrongPassword.popup_centered()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -115,3 +121,17 @@ func send_join_room():
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
func _on_NoSuchRoom_ConfirmButton_pressed():
|
||||||
|
$NoSuchRoom.hide()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
func _on_WrongPassword_ConfirmButton_pressed():
|
||||||
|
$WrongPassword.hide()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_NoSeat_ConfirmButton_pressed():
|
||||||
|
$NoSeat.hide()
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=23 format=2]
|
[gd_scene load_steps=25 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://Asset/HallBackground.png" type="Texture" id=1]
|
[ext_resource path="res://Asset/HallBackground.png" type="Texture" id=1]
|
||||||
[ext_resource path="res://Asset/Button/RoomControl/CreateRoom.png" type="Texture" id=2]
|
[ext_resource path="res://Asset/Button/RoomControl/CreateRoom.png" type="Texture" id=2]
|
||||||
@@ -73,6 +73,14 @@ font_data = ExtResource( 8 )
|
|||||||
flags = 4
|
flags = 4
|
||||||
load_path = "res://.import/QuitButton.png-31c18ce8db720f95af92c09426515d86.stex"
|
load_path = "res://.import/QuitButton.png-31c18ce8db720f95af92c09426515d86.stex"
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxTexture" id=14]
|
||||||
|
texture = ExtResource( 7 )
|
||||||
|
region_rect = Rect2( 0, 0, 640, 569 )
|
||||||
|
|
||||||
|
[sub_resource type="DynamicFont" id=12]
|
||||||
|
size = 72
|
||||||
|
font_data = ExtResource( 8 )
|
||||||
|
|
||||||
[node name="Node2D" type="Node2D"]
|
[node name="Node2D" type="Node2D"]
|
||||||
script = ExtResource( 4 )
|
script = ExtResource( 4 )
|
||||||
|
|
||||||
@@ -114,7 +122,6 @@ __meta__ = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[node name="CreateRoomDialog" type="PopupPanel" parent="."]
|
[node name="CreateRoomDialog" type="PopupPanel" parent="."]
|
||||||
visible = true
|
|
||||||
margin_right = 930.0
|
margin_right = 930.0
|
||||||
margin_bottom = 580.0
|
margin_bottom = 580.0
|
||||||
custom_styles/panel = SubResource( 1 )
|
custom_styles/panel = SubResource( 1 )
|
||||||
@@ -362,9 +369,132 @@ texture_normal = SubResource( 11 )
|
|||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[node name="NoSuchRoom" type="PopupDialog" parent="."]
|
||||||
|
margin_right = 500.0
|
||||||
|
margin_bottom = 500.0
|
||||||
|
custom_styles/panel = SubResource( 14 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="NoSuchRoom"]
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
margin_left = -216.0
|
||||||
|
margin_top = -94.0
|
||||||
|
margin_right = 216.0
|
||||||
|
margin_bottom = 94.0
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="NoSuchRoom/VBoxContainer"]
|
||||||
|
margin_right = 432.0
|
||||||
|
margin_bottom = 105.0
|
||||||
|
custom_fonts/font = SubResource( 12 )
|
||||||
|
custom_colors/font_color = Color( 0, 0, 0, 1 )
|
||||||
|
text = "此房间不存在"
|
||||||
|
|
||||||
|
[node name="HBoxContainer" type="HBoxContainer" parent="NoSuchRoom/VBoxContainer"]
|
||||||
|
margin_top = 113.0
|
||||||
|
margin_right = 432.0
|
||||||
|
margin_bottom = 188.0
|
||||||
|
alignment = 1
|
||||||
|
|
||||||
|
[node name="ConfirmButton" type="TextureButton" parent="NoSuchRoom/VBoxContainer/HBoxContainer"]
|
||||||
|
margin_left = 105.0
|
||||||
|
margin_right = 326.0
|
||||||
|
margin_bottom = 75.0
|
||||||
|
texture_normal = ExtResource( 5 )
|
||||||
|
|
||||||
|
[node name="WrongPassword" type="PopupDialog" parent="."]
|
||||||
|
margin_right = 500.0
|
||||||
|
margin_bottom = 500.0
|
||||||
|
custom_styles/panel = SubResource( 14 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="WrongPassword"]
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
margin_left = -216.0
|
||||||
|
margin_top = -94.0
|
||||||
|
margin_right = 216.0
|
||||||
|
margin_bottom = 94.0
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="WrongPassword/VBoxContainer"]
|
||||||
|
margin_right = 432.0
|
||||||
|
margin_bottom = 105.0
|
||||||
|
custom_fonts/font = SubResource( 12 )
|
||||||
|
custom_colors/font_color = Color( 0, 0, 0, 1 )
|
||||||
|
text = "房间密码错误"
|
||||||
|
|
||||||
|
[node name="HBoxContainer" type="HBoxContainer" parent="WrongPassword/VBoxContainer"]
|
||||||
|
margin_top = 113.0
|
||||||
|
margin_right = 432.0
|
||||||
|
margin_bottom = 188.0
|
||||||
|
alignment = 1
|
||||||
|
|
||||||
|
[node name="ConfirmButton" type="TextureButton" parent="WrongPassword/VBoxContainer/HBoxContainer"]
|
||||||
|
margin_left = 105.0
|
||||||
|
margin_right = 326.0
|
||||||
|
margin_bottom = 75.0
|
||||||
|
texture_normal = ExtResource( 5 )
|
||||||
|
|
||||||
|
[node name="NoSeat" type="PopupDialog" parent="."]
|
||||||
|
margin_right = 500.0
|
||||||
|
margin_bottom = 500.0
|
||||||
|
custom_styles/panel = SubResource( 14 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="NoSeat"]
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
margin_left = -216.0
|
||||||
|
margin_top = -94.0
|
||||||
|
margin_right = 216.0
|
||||||
|
margin_bottom = 94.0
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="NoSeat/VBoxContainer"]
|
||||||
|
margin_right = 432.0
|
||||||
|
margin_bottom = 105.0
|
||||||
|
custom_fonts/font = SubResource( 12 )
|
||||||
|
custom_colors/font_color = Color( 0, 0, 0, 1 )
|
||||||
|
text = "房间人数已满"
|
||||||
|
|
||||||
|
[node name="HBoxContainer" type="HBoxContainer" parent="NoSeat/VBoxContainer"]
|
||||||
|
margin_top = 113.0
|
||||||
|
margin_right = 432.0
|
||||||
|
margin_bottom = 188.0
|
||||||
|
alignment = 1
|
||||||
|
|
||||||
|
[node name="ConfirmButton" type="TextureButton" parent="NoSeat/VBoxContainer/HBoxContainer"]
|
||||||
|
margin_left = 105.0
|
||||||
|
margin_right = 326.0
|
||||||
|
margin_bottom = 75.0
|
||||||
|
texture_normal = ExtResource( 5 )
|
||||||
[connection signal="pressed" from="ButtonContainer/CreateRoomButton" to="." method="_on_CreateRoomButton_pressed"]
|
[connection signal="pressed" from="ButtonContainer/CreateRoomButton" to="." method="_on_CreateRoomButton_pressed"]
|
||||||
[connection signal="pressed" from="ButtonContainer/EnterRoomButton" to="." method="_on_EnterRoomButton_pressed"]
|
[connection signal="pressed" from="ButtonContainer/EnterRoomButton" to="." method="_on_EnterRoomButton_pressed"]
|
||||||
[connection signal="pressed" from="CreateRoomDialog/VoxContainer/ButtonContainer/ConfirmButton" to="." method="_on_CreateRoom_ConfirmButton_pressed"]
|
[connection signal="pressed" from="CreateRoomDialog/VoxContainer/ButtonContainer/ConfirmButton" to="." method="_on_CreateRoom_ConfirmButton_pressed"]
|
||||||
[connection signal="pressed" from="CreateRoomDialog/VoxContainer/ButtonContainer/CancelButton" to="." method="_on_CreateRoom_CancelButton_pressed"]
|
[connection signal="pressed" from="CreateRoomDialog/VoxContainer/ButtonContainer/CancelButton" to="." method="_on_CreateRoom_CancelButton_pressed"]
|
||||||
[connection signal="pressed" from="JoinRoomDialog/VoxContainer/ButtonContainer/ConfirmButton" to="." method="_on_JoinRoom_ConfirmButton_pressed"]
|
[connection signal="pressed" from="JoinRoomDialog/VoxContainer/ButtonContainer/ConfirmButton" to="." method="_on_JoinRoom_ConfirmButton_pressed"]
|
||||||
[connection signal="pressed" from="JoinRoomDialog/VoxContainer/ButtonContainer/CancelButton" to="." method="_on_JoinRoom_CancelButton_pressed"]
|
[connection signal="pressed" from="JoinRoomDialog/VoxContainer/ButtonContainer/CancelButton" to="." method="_on_JoinRoom_CancelButton_pressed"]
|
||||||
|
[connection signal="pressed" from="NoSuchRoom/VBoxContainer/HBoxContainer/ConfirmButton" to="." method="_on_NoSuchRoom_ConfirmButton_pressed"]
|
||||||
|
[connection signal="pressed" from="WrongPassword/VBoxContainer/HBoxContainer/ConfirmButton" to="." method="_on_WrongPassword_ConfirmButton_pressed"]
|
||||||
|
[connection signal="pressed" from="NoSeat/VBoxContainer/HBoxContainer/ConfirmButton" to="." method="_on_NoSeat_ConfirmButton_pressed"]
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ enum chow_type{LEFT, MID, RIGHT, NAC}
|
|||||||
|
|
||||||
enum gender{FEMALE, MALE}
|
enum gender{FEMALE, MALE}
|
||||||
|
|
||||||
|
enum join_err{WRONG_PASSWORD=-3, NO_SEAT, NO_SUCH_ROOM}
|
||||||
|
|
||||||
var game_msg_dict = {
|
var game_msg_dict = {
|
||||||
"msg_type":msg_type.GAME_MSG,
|
"msg_type":msg_type.GAME_MSG,
|
||||||
"table_order":0,
|
"table_order":0,
|
||||||
|
|||||||
+2
-4
@@ -366,9 +366,9 @@ anchor_left = 0.5
|
|||||||
anchor_top = 0.5
|
anchor_top = 0.5
|
||||||
anchor_right = 0.5
|
anchor_right = 0.5
|
||||||
anchor_bottom = 0.5
|
anchor_bottom = 0.5
|
||||||
margin_left = 833.0
|
margin_left = 842.0
|
||||||
margin_top = 614.0
|
margin_top = 614.0
|
||||||
margin_right = 1069.0
|
margin_right = 1078.0
|
||||||
margin_bottom = 713.0
|
margin_bottom = 713.0
|
||||||
texture_normal = ExtResource( 32 )
|
texture_normal = ExtResource( 32 )
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
@@ -723,7 +723,6 @@ margin_bottom = 51.0
|
|||||||
texture_normal = ExtResource( 45 )
|
texture_normal = ExtResource( 45 )
|
||||||
|
|
||||||
[node name="GameResultPanel" type="PopupPanel" parent="."]
|
[node name="GameResultPanel" type="PopupPanel" parent="."]
|
||||||
visible = true
|
|
||||||
margin_left = 493.0
|
margin_left = 493.0
|
||||||
margin_top = 251.0
|
margin_top = 251.0
|
||||||
margin_right = 1426.0
|
margin_right = 1426.0
|
||||||
@@ -757,7 +756,6 @@ custom_fonts/font = SubResource( 8 )
|
|||||||
custom_colors/font_color = Color( 0, 0, 0, 1 )
|
custom_colors/font_color = Color( 0, 0, 0, 1 )
|
||||||
|
|
||||||
[node name="DisconnectDialog" type="PopupDialog" parent="."]
|
[node name="DisconnectDialog" type="PopupDialog" parent="."]
|
||||||
visible = true
|
|
||||||
margin_right = 600.0
|
margin_right = 600.0
|
||||||
margin_bottom = 400.0
|
margin_bottom = 400.0
|
||||||
custom_styles/panel = SubResource( 9 )
|
custom_styles/panel = SubResource( 9 )
|
||||||
|
|||||||
Reference in New Issue
Block a user