UI: 打牌区域分行显示、聊天框透明
This commit is contained in:
@@ -19,6 +19,7 @@ class Tile:
|
||||
const OPPOSITE_HAND_HEIGHT = 120
|
||||
const OPPOSITE_DROP_WIDTH = 76
|
||||
const OPPOSITE_DROP_HEIGHT = 118
|
||||
const OPPOSITE_DROP_THICK = 32
|
||||
|
||||
const SIDE_SCALE = 0.6
|
||||
const SIDE_HAND_WIDTH = 50
|
||||
@@ -33,6 +34,8 @@ class Tile:
|
||||
const BOTTOM_DROP_WIDTH = 76
|
||||
const BOTTOM_DROP_HEIGHT = 118
|
||||
const BOTTOM_DROP_THICK = 32
|
||||
const BOTTOM_DROP_MARGIN_X = 400
|
||||
const BOTTOM_DROP_COUNT_MAX = 14
|
||||
const BOTTOM_SHOWN_SEP = 20
|
||||
|
||||
const RESULT_SCALE = 0.7
|
||||
|
||||
@@ -28,9 +28,12 @@ func get_tile_instance(suit, number):
|
||||
return tile
|
||||
|
||||
func show_tiles():
|
||||
var row = -1
|
||||
for i in range(get_children().size()):
|
||||
get_children()[i].position = Vector2(i*Constants.Tile.BOTTOM_DROP_WIDTH, 0)
|
||||
pass
|
||||
if i % 14 == 0:
|
||||
row += 1
|
||||
get_children()[i].set_z_index(5-row)
|
||||
get_children()[i].position = Vector2((i%14)*Constants.Tile.BOTTOM_DROP_WIDTH, -row*(Constants.Tile.BOTTOM_DROP_HEIGHT-Constants.Tile.BOTTOM_DROP_THICK))
|
||||
|
||||
func clear_tiles():
|
||||
for tile in get_children():
|
||||
|
||||
@@ -29,10 +29,13 @@ func get_tile_instance(suit, number):
|
||||
return tile
|
||||
|
||||
func show_tiles():
|
||||
# self.position = Vector2(Constants.Table.)
|
||||
var row = -1
|
||||
for i in range(get_children().size()):
|
||||
get_children()[i].position = Vector2(-i*Constants.Tile.SIDE_DROP_DIFF,
|
||||
i*(Constants.Tile.SIDE_DROP_HEIGHT-Constants.Tile.SIDE_DROP_THICK))
|
||||
|
||||
if i % 13 == 0:
|
||||
row += 1
|
||||
get_children()[i].position = Vector2(row*Constants.Tile.SIDE_DROP_HEIGHT,
|
||||
(i%13)*(Constants.Tile.SIDE_DROP_HEIGHT-Constants.Tile.SIDE_DROP_THICK))
|
||||
|
||||
func clear_tiles():
|
||||
for tile in get_children():
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ func _ready():
|
||||
hide_texture = ImageTexture.new()
|
||||
hide_texture = load("res://Asset/Tile/HideTileBottom.png")
|
||||
position = Vector2(Constants.Screen.WIDTH-Constants.Table.BOTTOM_SHOWN_MARGIN_X-
|
||||
3*Constants.Tile.BOTTOM_DROP_WIDTH, Constants.Table.BOTTOM_SHOWN_MARGIN_Y+Constants.Tile.OPPOSITE_HAND_HEIGHT)
|
||||
3*Constants.Tile.BOTTOM_DROP_WIDTH, Constants.Table.BOTTOM_SHOWN_MARGIN_Y+Constants.Tile.OPPOSITE_HAND_HEIGHT-20)
|
||||
|
||||
|
||||
func show_tiles(tiles):
|
||||
|
||||
@@ -28,9 +28,11 @@ func get_tile_instance(suit, number):
|
||||
return tile
|
||||
|
||||
func show_tiles():
|
||||
var row = -1
|
||||
for i in range(get_children().size()):
|
||||
get_children()[i].position = Vector2(-i*Constants.Tile.OPPOSITE_DROP_WIDTH, 0)
|
||||
pass
|
||||
if i % 14 == 0:
|
||||
row += 1
|
||||
get_children()[i].position = Vector2(-(i%14)*Constants.Tile.OPPOSITE_DROP_WIDTH, row*(Constants.Tile.OPPOSITE_DROP_HEIGHT-Constants.Tile.OPPOSITE_DROP_THICK))
|
||||
|
||||
func clear_tiles():
|
||||
for tile in get_children():
|
||||
|
||||
@@ -30,7 +30,7 @@ func rearrange_tiles():
|
||||
tiles[i].position = Vector2(i*Constants.Tile.OPPOSITE_HAND_WIDTH, 0)
|
||||
var x = (Constants.Screen.WIDTH - get_children().size()*Constants.Tile.OPPOSITE_HAND_WIDTH)/2.0
|
||||
var y = Constants.Table.OPPO_HAND_MARGIN_Y
|
||||
self.position = Vector2(x, y)
|
||||
self.position = Vector2(x, y-20)
|
||||
|
||||
func get_tile_instance():
|
||||
var tile = Sprite.new()
|
||||
|
||||
@@ -16,6 +16,7 @@ func _ready():
|
||||
|
||||
|
||||
func show_result(msg):
|
||||
set("z", 6)
|
||||
clear_tiles()
|
||||
popup_centered(Vector2(1200, 550))
|
||||
for i in range(4):
|
||||
|
||||
@@ -32,9 +32,12 @@ func get_tile_instance(suit, number):
|
||||
return tile
|
||||
|
||||
func show_tiles():
|
||||
var row = -1
|
||||
for i in range(tiles.size()):
|
||||
tiles[i].position = Vector2(-i*Constants.Tile.SIDE_DROP_DIFF,
|
||||
-i*(Constants.Tile.SIDE_DROP_HEIGHT-Constants.Tile.SIDE_DROP_THICK))
|
||||
if i % 13 == 0:
|
||||
row += 1
|
||||
tiles[i].position = Vector2(-row*Constants.Tile.SIDE_DROP_HEIGHT,
|
||||
-(i%13)*(Constants.Tile.SIDE_DROP_HEIGHT-Constants.Tile.SIDE_DROP_THICK))
|
||||
|
||||
|
||||
func clear_tiles():
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ func _ready():
|
||||
hide_texture = ImageTexture.new()
|
||||
hide_texture = load("res://Asset/Tile/HideTileRight.png")
|
||||
position = Vector2(Constants.Screen.WIDTH-Constants.Tile.SIDE_DROP_WIDTH-Constants.Table.SIDE_SHOWN_MARGIN_X,
|
||||
Constants.Screen.HEIGHT-Constants.Table.SIDE_SHOWN_MARGIN_Y-3*(Constants.Tile.SIDE_DROP_HEIGHT-Constants.Tile.SIDE_DROP_THICK)-Constants.Tile.SIDE_DROP_THICK)
|
||||
Constants.Screen.HEIGHT-Constants.Table.SIDE_SHOWN_MARGIN_Y-3*(Constants.Tile.SIDE_DROP_HEIGHT-Constants.Tile.SIDE_DROP_THICK)-Constants.Tile.SIDE_DROP_THICK+40)
|
||||
|
||||
|
||||
func show_tiles(tiles):
|
||||
|
||||
+2
-3
@@ -22,8 +22,7 @@ func _ready():
|
||||
ConnManager.connect("recv_join_msg", self, "handle_join_msg")
|
||||
ConnManager.connect("conn_failed", self, "handle_conn_failed")
|
||||
|
||||
|
||||
$ChatField.connect("send_chat", self, "handle_send_chat_pressed")
|
||||
$ChatNode/ChatField.connect("send_chat", self, "handle_send_chat_pressed")
|
||||
|
||||
|
||||
$PlayerAction/Chow.connect("pressed", self, "handle_chow")
|
||||
@@ -66,7 +65,7 @@ func handle_game_result_msg(msg):
|
||||
var winner = int(msg["winner"])
|
||||
if winner >= 0:
|
||||
play_action_audio(Message.player_action.WIN, msg["user_list"][winner]["gender"])
|
||||
$GameResultPanel.show_result(msg)
|
||||
$ResultNode/GameResultPanel.show_result(msg)
|
||||
$PlayerAction.hide()
|
||||
$ReadyButton.show()
|
||||
print_debug("winner: ", winner)
|
||||
|
||||
+107
-100
@@ -72,22 +72,6 @@ font_data = ExtResource( 41 )
|
||||
size = 32
|
||||
font_data = ExtResource( 41 )
|
||||
|
||||
[sub_resource type="StyleBoxTexture" id=5]
|
||||
texture = ExtResource( 44 )
|
||||
region_rect = Rect2( 0, 0, 660, 60 )
|
||||
|
||||
[sub_resource type="DynamicFont" id=6]
|
||||
size = 32
|
||||
font_data = ExtResource( 41 )
|
||||
|
||||
[sub_resource type="StyleBoxTexture" id=7]
|
||||
texture = ExtResource( 52 )
|
||||
region_rect = Rect2( 0, 0, 640, 569 )
|
||||
|
||||
[sub_resource type="DynamicFont" id=8]
|
||||
size = 32
|
||||
font_data = ExtResource( 41 )
|
||||
|
||||
[sub_resource type="StyleBoxTexture" id=9]
|
||||
texture = ExtResource( 52 )
|
||||
region_rect = Rect2( 0, 0, 640, 569 )
|
||||
@@ -104,6 +88,23 @@ load_path = "res://.import/ExitButton.png-90bb905636ba19a1a2935f9c69eb1cf7.stex"
|
||||
size = 64
|
||||
font_data = ExtResource( 41 )
|
||||
|
||||
[sub_resource type="StyleBoxTexture" id=5]
|
||||
texture = ExtResource( 44 )
|
||||
region_rect = Rect2( 0, 0, 660, 60 )
|
||||
modulate_color = Color( 1, 1, 1, 0.588235 )
|
||||
|
||||
[sub_resource type="DynamicFont" id=6]
|
||||
size = 32
|
||||
font_data = ExtResource( 41 )
|
||||
|
||||
[sub_resource type="StyleBoxTexture" id=7]
|
||||
texture = ExtResource( 52 )
|
||||
region_rect = Rect2( 0, 0, 640, 569 )
|
||||
|
||||
[sub_resource type="DynamicFont" id=8]
|
||||
size = 32
|
||||
font_data = ExtResource( 41 )
|
||||
|
||||
[node name="Table" type="Node2D"]
|
||||
script = ExtResource( 6 )
|
||||
|
||||
@@ -170,11 +171,11 @@ position = Vector2( 896.551, 142.818 )
|
||||
script = ExtResource( 8 )
|
||||
|
||||
[node name="OppoShown" type="Node2D" parent="."]
|
||||
position = Vector2( 1573.25, 148.362 )
|
||||
position = Vector2( 1573.25, 138.362 )
|
||||
script = ExtResource( 24 )
|
||||
|
||||
[node name="OppositeDropArea" type="Node2D" parent="."]
|
||||
position = Vector2( 1222.13, 256.318 )
|
||||
position = Vector2( 1450, 285 )
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="LeftHand" type="Node2D" parent="."]
|
||||
@@ -186,7 +187,7 @@ position = Vector2( 256.542, 126.726 )
|
||||
script = ExtResource( 25 )
|
||||
|
||||
[node name="LeftDropArea" type="Node2D" parent="."]
|
||||
position = Vector2( 383.452, 332.188 )
|
||||
position = Vector2( 250, 250 )
|
||||
script = ExtResource( 22 )
|
||||
|
||||
[node name="RightHand" type="Node2D" parent="."]
|
||||
@@ -198,11 +199,11 @@ position = Vector2( 1718.52, 856.17 )
|
||||
script = ExtResource( 26 )
|
||||
|
||||
[node name="RightDropArea" type="Node2D" parent="."]
|
||||
position = Vector2( 1570.72, 658.225 )
|
||||
position = Vector2( 1600, 820 )
|
||||
script = ExtResource( 3 )
|
||||
|
||||
[node name="BottomDropArea" type="Node2D" parent="."]
|
||||
position = Vector2( 621.315, 779.207 )
|
||||
position = Vector2( 400, 779.207 )
|
||||
script = ExtResource( 20 )
|
||||
|
||||
[node name="BottomShown" type="Node2D" parent="."]
|
||||
@@ -297,12 +298,11 @@ margin_bottom = 37.0
|
||||
text = "Start"
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
|
||||
visible = false
|
||||
margin_top = 45.0
|
||||
margin_right = 1377.0
|
||||
margin_bottom = 82.0
|
||||
margin_right = 904.0
|
||||
margin_bottom = 37.0
|
||||
|
||||
[node name="Button" type="Button" parent="VBoxContainer/HBoxContainer"]
|
||||
visible = false
|
||||
margin_right = 111.0
|
||||
margin_bottom = 37.0
|
||||
text = "Add Tile"
|
||||
@@ -311,14 +311,14 @@ __meta__ = {
|
||||
}
|
||||
|
||||
[node name="Button3" type="Button" parent="VBoxContainer/HBoxContainer"]
|
||||
margin_left = 119.0
|
||||
margin_right = 261.0
|
||||
visible = false
|
||||
margin_right = 142.0
|
||||
margin_bottom = 37.0
|
||||
text = "Add to Left"
|
||||
|
||||
[node name="Button2" type="Button" parent="VBoxContainer/HBoxContainer"]
|
||||
margin_left = 269.0
|
||||
margin_right = 465.0
|
||||
visible = false
|
||||
margin_right = 196.0
|
||||
margin_bottom = 37.0
|
||||
text = "Add to Oppotite"
|
||||
__meta__ = {
|
||||
@@ -326,38 +326,37 @@ __meta__ = {
|
||||
}
|
||||
|
||||
[node name="Button4" type="Button" parent="VBoxContainer/HBoxContainer"]
|
||||
margin_left = 473.0
|
||||
margin_right = 610.0
|
||||
margin_right = 137.0
|
||||
margin_bottom = 37.0
|
||||
text = "RightHand"
|
||||
|
||||
[node name="Button5" type="Button" parent="VBoxContainer/HBoxContainer"]
|
||||
margin_left = 618.0
|
||||
margin_right = 777.0
|
||||
margin_left = 145.0
|
||||
margin_right = 304.0
|
||||
margin_bottom = 37.0
|
||||
text = "BottomDrop"
|
||||
|
||||
[node name="Button6" type="Button" parent="VBoxContainer/HBoxContainer"]
|
||||
margin_left = 785.0
|
||||
margin_right = 904.0
|
||||
margin_left = 312.0
|
||||
margin_right = 431.0
|
||||
margin_bottom = 37.0
|
||||
text = "LeftDrop"
|
||||
|
||||
[node name="Button7" type="Button" parent="VBoxContainer/HBoxContainer"]
|
||||
margin_left = 912.0
|
||||
margin_right = 1045.0
|
||||
margin_left = 439.0
|
||||
margin_right = 572.0
|
||||
margin_bottom = 37.0
|
||||
text = "RightDrop"
|
||||
|
||||
[node name="Button8" type="Button" parent="VBoxContainer/HBoxContainer"]
|
||||
margin_left = 1053.0
|
||||
margin_right = 1191.0
|
||||
margin_left = 580.0
|
||||
margin_right = 718.0
|
||||
margin_bottom = 37.0
|
||||
text = "OppoDrop"
|
||||
|
||||
[node name="Button9" type="Button" parent="VBoxContainer/HBoxContainer"]
|
||||
margin_left = 1199.0
|
||||
margin_right = 1377.0
|
||||
margin_left = 726.0
|
||||
margin_right = 904.0
|
||||
margin_bottom = 37.0
|
||||
text = "BottomShown"
|
||||
|
||||
@@ -594,6 +593,7 @@ wait_time = 2.0
|
||||
one_shot = true
|
||||
|
||||
[node name="Chat" type="TextureRect" parent="OppoAvatar"]
|
||||
visible = false
|
||||
margin_left = 127.0
|
||||
margin_right = 487.0
|
||||
margin_bottom = 231.0
|
||||
@@ -697,64 +697,6 @@ __meta__ = {
|
||||
wait_time = 2.0
|
||||
one_shot = true
|
||||
|
||||
[node name="ChatField" type="HBoxContainer" parent="."]
|
||||
margin_left = 1364.08
|
||||
margin_top = 821.17
|
||||
margin_right = 1897.08
|
||||
margin_bottom = 872.17
|
||||
script = ExtResource( 43 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="LineEdit" type="LineEdit" parent="ChatField"]
|
||||
margin_right = 423.0
|
||||
margin_bottom = 51.0
|
||||
size_flags_horizontal = 3
|
||||
custom_styles/normal = SubResource( 5 )
|
||||
custom_fonts/font = SubResource( 6 )
|
||||
custom_colors/font_color = Color( 0, 0, 0, 1 )
|
||||
placeholder_text = "输入聊天消息"
|
||||
|
||||
[node name="SendButton" type="TextureButton" parent="ChatField"]
|
||||
margin_left = 431.0
|
||||
margin_right = 533.0
|
||||
margin_bottom = 51.0
|
||||
texture_normal = ExtResource( 45 )
|
||||
|
||||
[node name="GameResultPanel" type="PopupPanel" parent="."]
|
||||
margin_left = 493.0
|
||||
margin_top = 251.0
|
||||
margin_right = 1426.0
|
||||
margin_bottom = 751.0
|
||||
rect_min_size = Vector2( 950, 550 )
|
||||
custom_styles/panel = SubResource( 7 )
|
||||
script = ExtResource( 53 )
|
||||
|
||||
[node name="Nickname0" type="Label" parent="GameResultPanel"]
|
||||
margin_right = 950.0
|
||||
margin_bottom = 550.0
|
||||
custom_fonts/font = SubResource( 8 )
|
||||
custom_colors/font_color = Color( 0, 0, 0, 1 )
|
||||
|
||||
[node name="Nickname1" type="Label" parent="GameResultPanel"]
|
||||
margin_right = 950.0
|
||||
margin_bottom = 550.0
|
||||
custom_fonts/font = SubResource( 8 )
|
||||
custom_colors/font_color = Color( 0, 0, 0, 1 )
|
||||
|
||||
[node name="Nickname2" type="Label" parent="GameResultPanel"]
|
||||
margin_right = 950.0
|
||||
margin_bottom = 550.0
|
||||
custom_fonts/font = SubResource( 8 )
|
||||
custom_colors/font_color = Color( 0, 0, 0, 1 )
|
||||
|
||||
[node name="Nickname3" type="Label" parent="GameResultPanel"]
|
||||
margin_right = 950.0
|
||||
margin_bottom = 550.0
|
||||
custom_fonts/font = SubResource( 8 )
|
||||
custom_colors/font_color = Color( 0, 0, 0, 1 )
|
||||
|
||||
[node name="DisconnectDialog" type="PopupDialog" parent="."]
|
||||
margin_right = 600.0
|
||||
margin_bottom = 400.0
|
||||
@@ -837,6 +779,71 @@ text = "00000"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="ChatNode" type="Node2D" parent="."]
|
||||
z_index = 6
|
||||
|
||||
[node name="ChatField" type="HBoxContainer" parent="ChatNode"]
|
||||
margin_left = 1364.08
|
||||
margin_top = 821.17
|
||||
margin_right = 1897.08
|
||||
margin_bottom = 872.17
|
||||
script = ExtResource( 43 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="LineEdit" type="LineEdit" parent="ChatNode/ChatField"]
|
||||
margin_right = 423.0
|
||||
margin_bottom = 51.0
|
||||
size_flags_horizontal = 3
|
||||
custom_styles/normal = SubResource( 5 )
|
||||
custom_fonts/font = SubResource( 6 )
|
||||
custom_colors/font_color = Color( 0, 0, 0, 1 )
|
||||
context_menu_enabled = false
|
||||
placeholder_text = "输入聊天消息"
|
||||
|
||||
[node name="SendButton" type="TextureButton" parent="ChatNode/ChatField"]
|
||||
margin_left = 431.0
|
||||
margin_right = 533.0
|
||||
margin_bottom = 51.0
|
||||
texture_normal = ExtResource( 45 )
|
||||
|
||||
[node name="ResultNode" type="Node2D" parent="."]
|
||||
z_index = 6
|
||||
|
||||
[node name="GameResultPanel" type="PopupPanel" parent="ResultNode"]
|
||||
margin_left = 493.0
|
||||
margin_top = 251.0
|
||||
margin_right = 1443.0
|
||||
margin_bottom = 801.0
|
||||
rect_min_size = Vector2( 950, 550 )
|
||||
custom_styles/panel = SubResource( 7 )
|
||||
script = ExtResource( 53 )
|
||||
|
||||
[node name="Nickname0" type="Label" parent="ResultNode/GameResultPanel"]
|
||||
margin_right = 950.0
|
||||
margin_bottom = 550.0
|
||||
custom_fonts/font = SubResource( 8 )
|
||||
custom_colors/font_color = Color( 0, 0, 0, 1 )
|
||||
|
||||
[node name="Nickname1" type="Label" parent="ResultNode/GameResultPanel"]
|
||||
margin_right = 950.0
|
||||
margin_bottom = 550.0
|
||||
custom_fonts/font = SubResource( 8 )
|
||||
custom_colors/font_color = Color( 0, 0, 0, 1 )
|
||||
|
||||
[node name="Nickname2" type="Label" parent="ResultNode/GameResultPanel"]
|
||||
margin_right = 950.0
|
||||
margin_bottom = 550.0
|
||||
custom_fonts/font = SubResource( 8 )
|
||||
custom_colors/font_color = Color( 0, 0, 0, 1 )
|
||||
|
||||
[node name="Nickname3" type="Label" parent="ResultNode/GameResultPanel"]
|
||||
margin_right = 950.0
|
||||
margin_bottom = 550.0
|
||||
custom_fonts/font = SubResource( 8 )
|
||||
custom_colors/font_color = Color( 0, 0, 0, 1 )
|
||||
[connection signal="pressed" from="VBoxContainer/TestButtons/StartButton" to="." method="_on_Button9_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/HBoxContainer/Button" to="." method="_on_Button_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/HBoxContainer/Button3" to="." method="_on_Button3_pressed"]
|
||||
@@ -853,4 +860,4 @@ __meta__ = {
|
||||
[connection signal="timeout" from="RightAvatar/Timer" to="RightAvatar" method="_on_Timer_timeout"]
|
||||
[connection signal="timeout" from="OppoAvatar/Timer" to="OppoAvatar" method="_on_Timer_timeout"]
|
||||
[connection signal="timeout" from="LeftAvatar/Timer" to="LeftAvatar" method="_on_Timer_timeout"]
|
||||
[connection signal="pressed" from="ChatField/SendButton" to="ChatField" method="_on_SendButton_pressed"]
|
||||
[connection signal="pressed" from="ChatNode/ChatField/SendButton" to="ChatNode/ChatField" method="_on_SendButton_pressed"]
|
||||
|
||||
Reference in New Issue
Block a user