init
4
.editorconfig
Normal file
@ -0,0 +1,4 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
2
.gitattributes
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
# Normalize EOL for all files that Git considers text files.
|
||||
* text=auto eol=lf
|
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# Godot 4+ specific ignores
|
||||
.godot/
|
||||
/android/
|
BIN
Assets/Fonts/文字主题.ttf
Normal file
35
Assets/Fonts/文字主题.ttf.import
Normal file
@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="font_data_dynamic"
|
||||
type="FontFile"
|
||||
uid="uid://bnipxsg3yhkk8"
|
||||
path="res://.godot/imported/文字主题.ttf-ad05905c64aafa4640a6c8a8d3bc782f.fontdata"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/Fonts/文字主题.ttf"
|
||||
dest_files=["res://.godot/imported/文字主题.ttf-ad05905c64aafa4640a6c8a8d3bc782f.fontdata"]
|
||||
|
||||
[params]
|
||||
|
||||
Rendering=null
|
||||
antialiasing=1
|
||||
generate_mipmaps=false
|
||||
disable_embedded_bitmaps=true
|
||||
multichannel_signed_distance_field=false
|
||||
msdf_pixel_range=8
|
||||
msdf_size=48
|
||||
allow_system_fallback=true
|
||||
force_autohinter=false
|
||||
hinting=1
|
||||
subpixel_positioning=4
|
||||
keep_rounding_remainders=true
|
||||
oversampling=0.0
|
||||
Fallbacks=null
|
||||
fallbacks=[]
|
||||
Compress=null
|
||||
compress=true
|
||||
preload=[]
|
||||
language_support={}
|
||||
script_support={}
|
||||
opentype_features={}
|
BIN
Assets/Sprites/pieces.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
34
Assets/Sprites/pieces.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://c7s3ms0ai1wh3"
|
||||
path="res://.godot/imported/pieces.png-4d7b9d34b14d08e0d5cacc86aee8bb87.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/Sprites/pieces.png"
|
||||
dest_files=["res://.godot/imported/pieces.png-4d7b9d34b14d08e0d5cacc86aee8bb87.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
BIN
Assets/Sprites/抽卡堆卡背.png
Normal file
After Width: | Height: | Size: 481 B |
34
Assets/Sprites/抽卡堆卡背.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://x3ls13tjvahe"
|
||||
path="res://.godot/imported/抽卡堆卡背.png-f3c2065758dc25461af3564b1d1342b1.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/Sprites/抽卡堆卡背.png"
|
||||
dest_files=["res://.godot/imported/抽卡堆卡背.png-f3c2065758dc25461af3564b1d1342b1.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
BIN
Assets/Sprites/洋葱.png
Normal file
After Width: | Height: | Size: 525 B |
34
Assets/Sprites/洋葱.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://2okarpdi5eb4"
|
||||
path="res://.godot/imported/洋葱.png-89f1e6125a02399936c23f7e21c45225.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/Sprites/洋葱.png"
|
||||
dest_files=["res://.godot/imported/洋葱.png-89f1e6125a02399936c23f7e21c45225.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
BIN
Assets/Sprites/浅绿棋盘.png
Normal file
After Width: | Height: | Size: 543 B |
34
Assets/Sprites/浅绿棋盘.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://duh3cnwihuqs6"
|
||||
path="res://.godot/imported/浅绿棋盘.png-fe6ff6464bea0cde87541060fbfd42f4.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/Sprites/浅绿棋盘.png"
|
||||
dest_files=["res://.godot/imported/浅绿棋盘.png-fe6ff6464bea0cde87541060fbfd42f4.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
BIN
Assets/Sprites/深绿棋盘.png
Normal file
After Width: | Height: | Size: 553 B |
34
Assets/Sprites/深绿棋盘.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bf70kkfpye7jn"
|
||||
path="res://.godot/imported/深绿棋盘.png-c3e3fb286e93a20289a1ad8ea67a43d3.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/Sprites/深绿棋盘.png"
|
||||
dest_files=["res://.godot/imported/深绿棋盘.png-c3e3fb286e93a20289a1ad8ea67a43d3.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
BIN
Assets/Sprites/白菜.png
Normal file
After Width: | Height: | Size: 545 B |
34
Assets/Sprites/白菜.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://c4alegnua0t02"
|
||||
path="res://.godot/imported/白菜.png-66b2ad416fdcb75255599b9ee87a33e1.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/Sprites/白菜.png"
|
||||
dest_files=["res://.godot/imported/白菜.png-66b2ad416fdcb75255599b9ee87a33e1.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
BIN
Assets/Sprites/胡萝卜.png
Normal file
After Width: | Height: | Size: 487 B |
34
Assets/Sprites/胡萝卜.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://ehvjk6ocgrra"
|
||||
path="res://.godot/imported/胡萝卜.png-79bd34c7bbdff486abf6e2cfb976360a.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/Sprites/胡萝卜.png"
|
||||
dest_files=["res://.godot/imported/胡萝卜.png-79bd34c7bbdff486abf6e2cfb976360a.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
BIN
Assets/Sprites/菜篮.png
Normal file
After Width: | Height: | Size: 554 B |
34
Assets/Sprites/菜篮.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://4ou015x3wv70"
|
||||
path="res://.godot/imported/菜篮.png-d20469a112f3b6cc9da08098a9feb16f.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/Sprites/菜篮.png"
|
||||
dest_files=["res://.godot/imported/菜篮.png-d20469a112f3b6cc9da08098a9feb16f.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
49
Assets/TileSets/Tilesets.tres
Normal file
@ -0,0 +1,49 @@
|
||||
[gd_resource type="TileSet" load_steps=13 format=3 uid="uid://d1gtddd47nuvg"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://c7s3ms0ai1wh3" path="res://Assets/Sprites/pieces.png" id="1_sqgb4"]
|
||||
[ext_resource type="Texture2D" uid="uid://x3ls13tjvahe" path="res://Assets/Sprites/抽卡堆卡背.png" id="2_fl4h7"]
|
||||
[ext_resource type="Texture2D" uid="uid://2okarpdi5eb4" path="res://Assets/Sprites/洋葱.png" id="3_8le8k"]
|
||||
[ext_resource type="Texture2D" uid="uid://c4alegnua0t02" path="res://Assets/Sprites/白菜.png" id="4_a7wud"]
|
||||
[ext_resource type="Texture2D" uid="uid://ehvjk6ocgrra" path="res://Assets/Sprites/胡萝卜.png" id="5_r0vo0"]
|
||||
[ext_resource type="Texture2D" uid="uid://4ou015x3wv70" path="res://Assets/Sprites/菜篮.png" id="6_epikl"]
|
||||
|
||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_s4o66"]
|
||||
texture = ExtResource("1_sqgb4")
|
||||
separation = Vector2i(1, 0)
|
||||
texture_region_size = Vector2i(48, 64)
|
||||
0:0/0 = 0
|
||||
1:0/0 = 0
|
||||
|
||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_jbmsg"]
|
||||
texture = ExtResource("2_fl4h7")
|
||||
texture_region_size = Vector2i(48, 71)
|
||||
0:0/0 = 0
|
||||
|
||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_n4ala"]
|
||||
texture = ExtResource("3_8le8k")
|
||||
texture_region_size = Vector2i(48, 64)
|
||||
0:0/0 = 0
|
||||
|
||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_852sm"]
|
||||
texture = ExtResource("4_a7wud")
|
||||
texture_region_size = Vector2i(48, 64)
|
||||
0:0/0 = 0
|
||||
|
||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_tbw6l"]
|
||||
texture = ExtResource("5_r0vo0")
|
||||
texture_region_size = Vector2i(48, 64)
|
||||
0:0/0 = 0
|
||||
|
||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_j7tek"]
|
||||
texture = ExtResource("6_epikl")
|
||||
texture_region_size = Vector2i(48, 64)
|
||||
0:0/0 = 0
|
||||
|
||||
[resource]
|
||||
tile_size = Vector2i(48, 64)
|
||||
sources/0 = SubResource("TileSetAtlasSource_s4o66")
|
||||
sources/1 = SubResource("TileSetAtlasSource_jbmsg")
|
||||
sources/2 = SubResource("TileSetAtlasSource_n4ala")
|
||||
sources/3 = SubResource("TileSetAtlasSource_852sm")
|
||||
sources/4 = SubResource("TileSetAtlasSource_tbw6l")
|
||||
sources/5 = SubResource("TileSetAtlasSource_j7tek")
|
36
Scenes/Card.tscn
Normal file
@ -0,0 +1,36 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://cgltpx2pqqn2y"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://crnunnenua5d3" path="res://Scripts/Card.gd" id="1_0qqmn"]
|
||||
[ext_resource type="Texture2D" uid="uid://2okarpdi5eb4" path="res://Assets/Sprites/洋葱.png" id="1_3p273"]
|
||||
[ext_resource type="Texture2D" uid="uid://c4alegnua0t02" path="res://Assets/Sprites/白菜.png" id="1_h8wm0"]
|
||||
[ext_resource type="FontFile" uid="uid://bnipxsg3yhkk8" path="res://Assets/Fonts/文字主题.ttf" id="3_3m7nw"]
|
||||
[ext_resource type="Texture2D" uid="uid://ehvjk6ocgrra" path="res://Assets/Sprites/胡萝卜.png" id="4_wejov"]
|
||||
[ext_resource type="Texture2D" uid="uid://4ou015x3wv70" path="res://Assets/Sprites/菜篮.png" id="5_c6tr3"]
|
||||
|
||||
[node name="Card" type="TextureButton"]
|
||||
offset_left = -24.0
|
||||
offset_top = -32.0
|
||||
offset_right = 24.0
|
||||
offset_bottom = 32.0
|
||||
texture_normal = ExtResource("1_3p273")
|
||||
script = ExtResource("1_0qqmn")
|
||||
onion_texture = ExtResource("1_3p273")
|
||||
cabbage_texture = ExtResource("1_h8wm0")
|
||||
carrot_texture = ExtResource("4_wejov")
|
||||
bucket_texture = ExtResource("5_c6tr3")
|
||||
|
||||
[node name="Value" type="Label" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 15.0
|
||||
offset_top = 3.0
|
||||
offset_right = 33.0
|
||||
offset_bottom = 17.0
|
||||
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
||||
theme_override_fonts/font = ExtResource("3_3m7nw")
|
||||
theme_override_font_sizes/font_size = 12
|
||||
text = "0"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[connection signal="button_down" from="." to="." method="_on_button_down"]
|
||||
[connection signal="button_up" from="." to="." method="_on_button_up"]
|
72
Scenes/Main.tscn
Normal file
@ -0,0 +1,72 @@
|
||||
[gd_scene load_steps=4 format=4 uid="uid://bdhkwmdjla3dy"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cvjgu1sx802tc" path="res://Scripts/GameManager.gd" id="1_r150o"]
|
||||
[ext_resource type="TileSet" uid="uid://d1gtddd47nuvg" path="res://Assets/TileSets/Tilesets.tres" id="2_idj7w"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_kln2b"]
|
||||
size = Vector2(48, 71)
|
||||
|
||||
[node name="GameRoot" type="Node2D" node_paths=PackedStringArray("left_top_of_board", "init_card_anchos", "board_area")]
|
||||
script = ExtResource("1_r150o")
|
||||
cols = 7
|
||||
cell_size = Vector2i(48, 64)
|
||||
left_top_of_board = NodePath("Tiles/Board/LeftTop")
|
||||
init_card_anchos = [NodePath("Tiles/Cards/Marker1"), NodePath("Tiles/Cards/Marker2"), NodePath("Tiles/Cards/Marker3"), NodePath("Tiles/Cards/Marker4")]
|
||||
board_area = NodePath("Tiles/Board/BoardArea")
|
||||
|
||||
[node name="Camera2D" type="Camera2D" parent="."]
|
||||
position = Vector2(-159, -32)
|
||||
zoom = Vector2(1.21, 1.21)
|
||||
|
||||
[node name="Tiles" type="Node2D" parent="."]
|
||||
|
||||
[node name="Board" type="TileMapLayer" parent="Tiles"]
|
||||
position = Vector2(80, 0)
|
||||
tile_map_data = PackedByteArray("AAD2//z/AAAAAAAAAAD3//3/AAAAAAAAAAD4//7/AAAAAAAAAAD5////AAAAAAAAAAD6/wAAAAAAAAAAAAD7/wEAAAAAAAAAAAD8/wIAAAAAAAAAAAD5/wEAAAAAAAAAAAD7////AAAAAAAAAAD8//7/AAAAAAAAAAD7//3/AAAAAAAAAAD4//z/AAAAAAAAAAD6//z/AAAAAAAAAAD5//3/AAAAAAAAAAD8//z/AAAAAAAAAAD2//7/AAAAAAAAAAD3////AAAAAAAAAAD2/wAAAAAAAAAAAAD3/wEAAAAAAAAAAAD4/wAAAAAAAAAAAAD2/wIAAAAAAAAAAAD4/wIAAAAAAAAAAAD6/wIAAAAAAAAAAAD8/wAAAAAAAAAAAAD6//7/AAAAAAAAAAD3//z/AAABAAAAAAD2//3/AAABAAAAAAD3//7/AAABAAAAAAD2////AAABAAAAAAD4////AAABAAAAAAD3/wAAAAABAAAAAAD2/wEAAAABAAAAAAD4/wEAAAABAAAAAAD3/wIAAAABAAAAAAD5/wIAAAABAAAAAAD7/wIAAAABAAAAAAD6/wEAAAABAAAAAAD7/wAAAAABAAAAAAD8/wEAAAABAAAAAAD5/wAAAAABAAAAAAD6////AAABAAAAAAD8////AAABAAAAAAD7//7/AAABAAAAAAD5//7/AAABAAAAAAD6//3/AAABAAAAAAD4//3/AAABAAAAAAD5//z/AAABAAAAAAD7//z/AAABAAAAAAD8//3/AAABAAAAAAA=")
|
||||
tile_set = ExtResource("2_idj7w")
|
||||
|
||||
[node name="LeftTop" type="Marker2D" parent="Tiles/Board"]
|
||||
position = Vector2(-480, -256)
|
||||
|
||||
[node name="BoardArea" type="ReferenceRect" parent="Tiles/Board"]
|
||||
offset_left = -480.0
|
||||
offset_top = -256.0
|
||||
offset_right = -144.0
|
||||
offset_bottom = 192.0
|
||||
|
||||
[node name="Cards" type="TileMapLayer" parent="Tiles"]
|
||||
position = Vector2(-32, 0)
|
||||
tile_map_data = PackedByteArray("AAABAPz/AQAAAAAAAAA=")
|
||||
tile_set = ExtResource("2_idj7w")
|
||||
|
||||
[node name="CardsArea" type="Area2D" parent="Tiles/Cards"]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Tiles/Cards/CardsArea"]
|
||||
position = Vector2(72, -224.5)
|
||||
shape = SubResource("RectangleShape2D_kln2b")
|
||||
|
||||
[node name="Marker1" type="Marker2D" parent="Tiles/Cards"]
|
||||
position = Vector2(72, -128)
|
||||
gizmo_extents = 24.0
|
||||
|
||||
[node name="Marker2" type="Marker2D" parent="Tiles/Cards"]
|
||||
position = Vector2(72, -40)
|
||||
gizmo_extents = 24.0
|
||||
|
||||
[node name="Marker3" type="Marker2D" parent="Tiles/Cards"]
|
||||
position = Vector2(72, 48)
|
||||
gizmo_extents = 24.0
|
||||
|
||||
[node name="Marker4" type="Marker2D" parent="Tiles/Cards"]
|
||||
position = Vector2(72, 136)
|
||||
gizmo_extents = 24.0
|
||||
|
||||
[node name="BoardCells" type="Node2D" parent="."]
|
||||
|
||||
[node name="MouseAnchor" type="Control" parent="."]
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
|
||||
[node name="Cards" type="Node2D" parent="."]
|
54
Scripts/Card.gd
Normal file
@ -0,0 +1,54 @@
|
||||
extends TextureButton
|
||||
|
||||
class_name Card
|
||||
|
||||
enum Category {
|
||||
Onion,
|
||||
Cabbage,
|
||||
Carrot,
|
||||
Bucket
|
||||
}
|
||||
|
||||
@export var mouse_follow_speed: int = 50
|
||||
|
||||
@export var index : Vector2 = Global.invalid_cell_index
|
||||
@export var category : Category = Category.Cabbage
|
||||
@export var value : int = 0
|
||||
|
||||
@export var onion_texture : Texture2D
|
||||
@export var cabbage_texture : Texture2D
|
||||
@export var carrot_texture : Texture2D
|
||||
@export var bucket_texture : Texture2D
|
||||
|
||||
var origin_pos : Vector2
|
||||
var has_mouse : bool
|
||||
var settled : bool
|
||||
|
||||
func setup_card(category: Category, value: int) -> void:
|
||||
origin_pos = global_position
|
||||
setup_sprite()
|
||||
|
||||
func setup_sprite() -> void:
|
||||
$Value.text = str(value)
|
||||
match category :
|
||||
Category.Onion:
|
||||
texture_normal = onion_texture
|
||||
Category.Cabbage:
|
||||
texture_normal = cabbage_texture
|
||||
Category.Carrot:
|
||||
texture_normal = carrot_texture
|
||||
Category.Bucket:
|
||||
texture_normal = bucket_texture
|
||||
|
||||
func _on_button_down() -> void:
|
||||
if !settled:
|
||||
has_mouse = true
|
||||
get_node("/root/GameRoot").emit_signal("dragging_card", self)
|
||||
|
||||
func _on_button_up() -> void:
|
||||
has_mouse = false
|
||||
|
||||
func _process(delta):
|
||||
pass
|
||||
#if has_mouse and !settled:
|
||||
#global_position = global_position.lerp(get_global_mouse_position(), mouse_follow_speed*delta)
|
1
Scripts/Card.gd.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://crnunnenua5d3
|
114
Scripts/GameManager.gd
Normal file
@ -0,0 +1,114 @@
|
||||
extends Node
|
||||
|
||||
@export var cols : int
|
||||
@export var cell_size : Vector2i
|
||||
@export var left_top_of_board : Marker2D
|
||||
@export var init_card_anchos : Array[Marker2D]
|
||||
|
||||
@export var board_area : ReferenceRect
|
||||
|
||||
signal dragging_card
|
||||
|
||||
var has_mouse: bool = false
|
||||
var dragged_card : Card
|
||||
|
||||
var hovered_cell : Vector2 = Global.invalid_cell_index
|
||||
var board_info : Array = []
|
||||
|
||||
func _ready() -> void:
|
||||
init_game()
|
||||
dragging_card.connect(_on_dragging_card)
|
||||
#board_area.mouse_entered.connect(_on_mouse_enter_board)
|
||||
#board_area.mouse_exited.connect(_on_mouse_exit_board)
|
||||
|
||||
func init_game() -> void:
|
||||
board_info = create_cells()
|
||||
send_cards()
|
||||
|
||||
func create_cells() -> Array:
|
||||
var cells_matrix = []
|
||||
var init_pos = Vector2(left_top_of_board.global_position.x, left_top_of_board.global_position.y)
|
||||
for i in range(0, cols):
|
||||
var row = []
|
||||
for j in range(0, cols):
|
||||
var left_top_pos = Vector2(init_pos.x + i * cell_size.x, init_pos.y + j * cell_size.y)
|
||||
var center_pos = Vector2(left_top_pos.x + cell_size.x / 2, left_top_pos.y + cell_size.y / 2)
|
||||
var cell = setup_cell_rect(center_pos, cell_size)
|
||||
var collision_box = cell.get_node("CollisionBox") as CollisionShape2D
|
||||
var shape = collision_box.shape
|
||||
var dict = {
|
||||
"global-left-top": Vector2(cell.global_position.x - shape.get_rect().size.x / 2, cell.global_position.y - shape.get_rect().size.y / 2),
|
||||
"index": Vector2i(i, j),
|
||||
"area": cell,
|
||||
"empty": true
|
||||
}
|
||||
row.append(dict)
|
||||
cells_matrix.append(row)
|
||||
return cells_matrix
|
||||
|
||||
func setup_cell_rect(left_top: Vector2, size: Vector2i) -> Area2D:
|
||||
var cell := Area2D.new()
|
||||
cell.global_position = left_top
|
||||
$BoardCells.add_child(cell)
|
||||
|
||||
# 添加 CollisionShape2D 节点
|
||||
var collision_shape = CollisionShape2D.new()
|
||||
collision_shape.name = "CollisionBox"
|
||||
cell.add_child(collision_shape)
|
||||
|
||||
# 设置 CollisionShape2D 为矩形,大小为棋盘格大小
|
||||
var shape = RectangleShape2D.new()
|
||||
shape.size = size
|
||||
collision_shape.shape = shape
|
||||
return cell
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
pass
|
||||
#if has_mouse and dragged_card != null:
|
||||
#clamp_card_on_cell(dragged_card)
|
||||
|
||||
func _on_dragging_card(card: Card) -> void:
|
||||
dragged_card = card
|
||||
|
||||
func get_hover_cell_index() -> Vector2i:
|
||||
var mouse_global_position = $MouseAnchor.get_global_mouse_position()
|
||||
return get_cell_on_pos(mouse_global_position)
|
||||
|
||||
func get_cell_on_pos(pos: Vector2) -> Vector2i:
|
||||
var relative_pos = Vector2(pos.x - left_top_of_board.global_position.x, pos.y - left_top_of_board.global_position.y)
|
||||
var index = Vector2i(int(relative_pos.x) / cell_size.x, int(relative_pos.y) / cell_size.y)
|
||||
if index.x < 0 or index.x >= cols or index.y < 0 or index.y >= cols:
|
||||
index = Global.invalid_cell_index
|
||||
return index
|
||||
|
||||
#func _on_mouse_enter_board() -> void:
|
||||
##if dragged_card != null:
|
||||
##dragged_card.handle_pos = false
|
||||
#has_mouse = true
|
||||
#print("board enter")
|
||||
#
|
||||
#func _on_mouse_exit_board() -> void:
|
||||
##if dragged_card != null:
|
||||
##dragged_card.handle_pos = true
|
||||
#has_mouse = false
|
||||
#print("board exit")
|
||||
|
||||
func clamp_card_on_cell(card: Card) -> void:
|
||||
var index = get_hover_cell_index()
|
||||
if index != Global.invalid_cell_index:
|
||||
var cell_info = board_info[index.x][index.y]
|
||||
#var cell_area = cell_info.area
|
||||
var pos = cell_info["global-left-top"]
|
||||
card.global_position = pos
|
||||
|
||||
func send_cards() -> void:
|
||||
var card_prefab = load("res://Scenes/Card.tscn")
|
||||
for i in range(init_card_anchos.size()):
|
||||
var pos = init_card_anchos[i].global_position
|
||||
var card_instance = card_prefab.instantiate()
|
||||
var card_size = (card_instance as Card).texture_normal.get_size()
|
||||
card_instance.global_position = Vector2(pos.x - card_size.x / 2, pos.y - card_size.y / 2)
|
||||
var val = randi() % 10
|
||||
var cate_num = randi() % 4
|
||||
card_instance.setup_card(cate_num, val)
|
||||
$Cards.add_child(card_instance)
|
1
Scripts/GameManager.gd.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://cvjgu1sx802tc
|
3
Scripts/Global.gd
Normal file
@ -0,0 +1,3 @@
|
||||
extends Node
|
||||
|
||||
const invalid_cell_index = Vector2i(-9999,-9999)
|
1
Scripts/Global.gd.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://b8rj2g54qmlyk
|
21
addons/godot-git-plugin/LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2016-2023 The Godot Engine community
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
1349
addons/godot-git-plugin/THIRDPARTY.md
Normal file
12
addons/godot-git-plugin/git_plugin.gdextension
Normal file
@ -0,0 +1,12 @@
|
||||
[configuration]
|
||||
|
||||
entry_symbol = "git_plugin_init"
|
||||
compatibility_minimum = "4.1.0"
|
||||
|
||||
[libraries]
|
||||
|
||||
macos.editor = "macos/libgit_plugin.macos.editor.universal.dylib"
|
||||
windows.editor.x86_64 = "win64/libgit_plugin.windows.editor.x86_64.dll"
|
||||
linux.editor.x86_64 = "linux/libgit_plugin.linux.editor.x86_64.so"
|
||||
linux.editor.arm64 = "linux/libgit_plugin.linux.editor.arm64.so"
|
||||
linux.editor.rv64 = ""
|
1
addons/godot-git-plugin/git_plugin.gdextension.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://jtygygdoibwj
|
7
addons/godot-git-plugin/plugin.cfg
Normal file
@ -0,0 +1,7 @@
|
||||
[plugin]
|
||||
|
||||
name="Godot Git Plugin"
|
||||
description="This plugin lets you interact with Git without leaving the Godot editor. More information can be found at https://github.com/godotengine/godot-git-plugin/wiki"
|
||||
author="twaritwaikar"
|
||||
version="v3.1.1"
|
||||
script="godot-git-plugin.gd"
|
1
icon.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128"><rect width="124" height="124" x="2" y="2" fill="#363d52" stroke="#212532" stroke-width="4" rx="14"/><g fill="#fff" transform="translate(12.322 12.322)scale(.101)"><path d="M105 673v33q407 354 814 0v-33z"/><path fill="#478cbf" d="m105 673 152 14q12 1 15 14l4 67 132 10 8-61q2-11 15-15h162q13 4 15 15l8 61 132-10 4-67q3-13 15-14l152-14V427q30-39 56-81-35-59-83-108-43 20-82 47-40-37-88-64 7-51 8-102-59-28-123-42-26 43-46 89-49-7-98 0-20-46-46-89-64 14-123 42 1 51 8 102-48 27-88 64-39-27-82-47-48 49-83 108 26 42 56 81zm0 33v39c0 276 813 276 814 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H446l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z"/><path d="M483 600c0 34 58 34 58 0v-86c0-34-58-34-58 0z"/><circle cx="725" cy="526" r="90"/><circle cx="299" cy="526" r="90"/></g><g fill="#414042" transform="translate(12.322 12.322)scale(.101)"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></svg>
|
After Width: | Height: | Size: 994 B |
37
icon.svg.import
Normal file
@ -0,0 +1,37 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://ccln8b7fqrpva"
|
||||
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://icon.svg"
|
||||
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=1.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
36
project.godot
Normal file
@ -0,0 +1,36 @@
|
||||
; Engine configuration file.
|
||||
; It's best edited using the editor UI and not directly,
|
||||
; since the parameters that go here are not all obvious.
|
||||
;
|
||||
; Format:
|
||||
; [section] ; section goes between []
|
||||
; param=value ; assign values to parameters
|
||||
|
||||
config_version=5
|
||||
|
||||
[application]
|
||||
|
||||
config/name="VegeCard"
|
||||
run/main_scene="uid://bdhkwmdjla3dy"
|
||||
config/features=PackedStringArray("4.4", "GL Compatibility")
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
[autoload]
|
||||
|
||||
Global="*res://Scripts/Global.gd"
|
||||
|
||||
[display]
|
||||
|
||||
window/size/viewport_width=700
|
||||
window/size/viewport_height=800
|
||||
|
||||
[editor]
|
||||
|
||||
version_control/plugin_name="GitPlugin"
|
||||
version_control/autoload_on_startup=true
|
||||
|
||||
[rendering]
|
||||
|
||||
textures/canvas_textures/default_texture_filter=0
|
||||
renderer/rendering_method="gl_compatibility"
|
||||
renderer/rendering_method.mobile="gl_compatibility"
|