init basic signal player chinese chess game

This commit is contained in:
ZZY 2024-06-15 18:07:20 +08:00
commit 9ba2e1af6b
71 changed files with 2752 additions and 0 deletions

2
.gitattributes vendored Normal file
View File

@ -0,0 +1,2 @@
# Normalize EOL for all files that Git considers text files.
* text=auto eol=lf

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
# Godot 4+ specific ignores
.godot/
bin/

3
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"godotTools.editorPath.godot4": "e:\\GAME_ENGINE\\Godot\\Godot_v4.2.2-stable_mono_win64\\Godot_v4.2.2-stable_mono_win64.exe"
}

38
Asserts/Chessboard.tres Normal file
View File

@ -0,0 +1,38 @@
[gd_resource type="TileSet" load_steps=7 format=3 uid="uid://bibjj3ay65ral"]
[ext_resource type="Texture2D" uid="uid://dolq1l3fr7jep" path="res://Asserts/pic/chessboard.png" id="2_5i53i"]
[ext_resource type="Texture2D" uid="uid://qdt3midw0lwa" path="res://Asserts/pic/cross_set_plus.png" id="3_ouwnc"]
[sub_resource type="TileMapPattern" id="TileMapPattern_s62cf"]
tile_data = PackedInt32Array(0, 36, 1610612737, 131072, 37, 1073741824, 262144, 196644, 1073741824, 393216, 196644, 1073741824, 524288, 36, 805306369, 2, 196644, 0, 131074, 131108, 0, 262146, 196644, 1, 393218, 131108, 0, 524290, 196644, 536870912, 4, 196644, 0, 131076, 196644, 1, 262148, 131108, 0, 393220, 131108, 0, 524292, 196644, 536870912, 6, 196644, 0, 131078, 131108, 0, 262150, 65572, 1, 393222, 65572, 2, 524294, 131108, 536870913, 8, 196644, 0, 131080, 196644, 1, 262152, 65572, 1342177282, 393224, 262180, 1, 524296, 262180, 536870912, 10, 196644, 0, 131082, 131108, 0, 262154, 65572, 1342177281, 393226, 65572, 268435458, 524298, 131108, 805306369, 12, 196644, 0, 131084, 196644, 1, 262156, 131108, 0, 393228, 131108, 0, 524300, 196644, 536870912, 14, 196644, 0, 131086, 131108, 0, 262158, 196644, 1, 393230, 131108, 0, 524302, 196644, 536870912, 16, 36, 1879048193, 131088, 37, 1342177280, 262160, 196644, 1342177280, 393232, 196644, 1342177280, 524304, 36, 536870913)
[sub_resource type="TileMapPattern" id="TileMapPattern_3yn03"]
tile_data = PackedInt32Array(0, 36, 268435457, 131072, 196644, 1610612736, 262144, 196644, 1610612736, 393216, 37, 1610612736, 524288, 36, 1073741825, 655360, 36, 1610612737, 786432, 37, 1073741824, 917504, 196644, 1073741824, 1048576, 196644, 1073741824, 1179648, 36, 805306369, 2, 196644, 0, 131074, 131108, 536870912, 262146, 196644, 536870913, 393218, 131108, 536870912, 524290, 196644, 536870912, 655362, 196644, 0, 786434, 131108, 0, 917506, 196644, 1, 1048578, 131108, 0, 1179650, 196644, 536870912, 4, 196644, 0, 131076, 131108, 536870912, 262148, 131108, 536870912, 393220, 196644, 536870913, 524292, 196644, 536870912, 655364, 196644, 0, 786436, 196644, 1, 917508, 131108, 0, 1048580, 131108, 0, 1179652, 196644, 536870912, 6, 131108, 1, 131078, 65572, 536870914, 262150, 65572, 536870913, 393222, 131108, 536870912, 524294, 196644, 536870912, 655366, 196644, 0, 786438, 131108, 0, 917510, 65572, 1, 1048582, 65572, 2, 1179654, 131108, 536870913, 8, 262180, 0, 131080, 262180, 536870913, 262152, 65572, 1879048194, 393224, 196644, 536870913, 524296, 196644, 536870912, 655368, 196644, 0, 786440, 196644, 1, 917512, 65572, 1342177282, 1048584, 262180, 1, 1179656, 262180, 536870912, 10, 131108, 268435457, 131082, 65572, 805306370, 262154, 65572, 1879048193, 393226, 131108, 536870912, 524298, 196644, 536870912, 655370, 196644, 0, 786442, 131108, 0, 917514, 65572, 1342177281, 1048586, 65572, 268435458, 1179658, 131108, 805306369, 12, 196644, 0, 131084, 131108, 536870912, 262156, 131108, 536870912, 393228, 196644, 536870913, 524300, 196644, 536870912, 655372, 196644, 0, 786444, 196644, 1, 917516, 131108, 0, 1048588, 131108, 0, 1179660, 196644, 536870912, 14, 196644, 0, 131086, 131108, 536870912, 262158, 196644, 536870913, 393230, 131108, 536870912, 524302, 196644, 536870912, 655374, 196644, 0, 786446, 131108, 0, 917518, 196644, 1, 1048590, 131108, 0, 1179662, 196644, 536870912, 16, 36, 1, 131088, 196644, 1879048192, 262160, 196644, 1879048192, 393232, 37, 1879048192, 524304, 36, 1342177281, 655376, 36, 1879048193, 786448, 37, 1342177280, 917520, 196644, 1342177280, 1048592, 196644, 1342177280, 1179664, 36, 536870913)
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_7ihb1"]
texture = ExtResource("2_5i53i")
texture_region_size = Vector2i(32, 32)
0:0/0 = 0
1:0/0 = 0
2:0/0 = 0
3:0/0 = 0
4:0/0 = 0
0:1/0 = 0
1:1/0 = 0
2:1/0 = 0
3:1/0 = 0
4:1/0 = 0
0:2/0 = 0
1:2/0 = 0
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_je1ok"]
texture = ExtResource("3_ouwnc")
texture_region_size = Vector2i(32, 32)
0:0/0 = 0
[resource]
sources/36 = SubResource("TileSetAtlasSource_7ihb1")
sources/37 = SubResource("TileSetAtlasSource_je1ok")
tile_proxies/coords_level = [[0, Vector2i(0, 0)], [10, Vector2i(0, 0)], [0, Vector2i(0, 1)], [10, Vector2i(0, 1)], [0, Vector2i(1, 0)], [10, Vector2i(1, 0)], [0, Vector2i(1, 1)], [10, Vector2i(1, 1)], [1, Vector2i(0, 0)], [10, Vector2i(2, 0)], [1, Vector2i(0, 1)], [10, Vector2i(2, 1)], [1, Vector2i(1, 0)], [10, Vector2i(3, 0)], [1, Vector2i(1, 1)], [10, Vector2i(3, 1)], [2, Vector2i(0, 0)], [10, Vector2i(4, 0)], [2, Vector2i(0, 1)], [10, Vector2i(4, 1)], [2, Vector2i(1, 0)], [10, Vector2i(5, 0)], [2, Vector2i(1, 1)], [10, Vector2i(5, 1)], [3, Vector2i(0, 0)], [10, Vector2i(6, 0)], [3, Vector2i(0, 1)], [10, Vector2i(6, 1)], [3, Vector2i(1, 0)], [10, Vector2i(7, 0)], [3, Vector2i(1, 1)], [10, Vector2i(7, 1)], [4, Vector2i(0, 0)], [10, Vector2i(8, 0)], [4, Vector2i(0, 1)], [10, Vector2i(8, 1)], [4, Vector2i(1, 0)], [10, Vector2i(9, 0)], [4, Vector2i(1, 1)], [10, Vector2i(9, 1)], [5, Vector2i(0, 0)], [10, Vector2i(0, 2)], [5, Vector2i(0, 1)], [10, Vector2i(0, 3)], [5, Vector2i(1, 0)], [10, Vector2i(1, 2)], [5, Vector2i(1, 1)], [10, Vector2i(1, 3)], [6, Vector2i(0, 0)], [10, Vector2i(2, 2)], [6, Vector2i(0, 1)], [10, Vector2i(2, 3)], [6, Vector2i(1, 0)], [10, Vector2i(3, 2)], [6, Vector2i(1, 1)], [10, Vector2i(3, 3)], [8, Vector2i(0, 0)], [10, Vector2i(4, 2)], [8, Vector2i(0, 1)], [10, Vector2i(4, 3)], [8, Vector2i(1, 0)], [10, Vector2i(5, 2)], [8, Vector2i(1, 1)], [10, Vector2i(5, 3)], [9, Vector2i(0, 0)], [10, Vector2i(6, 2)], [9, Vector2i(0, 1)], [10, Vector2i(6, 3)], [9, Vector2i(1, 0)], [10, Vector2i(7, 2)], [9, Vector2i(1, 1)], [10, Vector2i(7, 3)], [11, Vector2i(0, 0)], [22, Vector2i(0, 0)], [11, Vector2i(0, 1)], [22, Vector2i(0, 1)], [11, Vector2i(1, 0)], [22, Vector2i(1, 0)], [11, Vector2i(1, 1)], [22, Vector2i(1, 1)], [12, Vector2i(0, 0)], [22, Vector2i(2, 0)], [12, Vector2i(0, 1)], [22, Vector2i(2, 1)], [12, Vector2i(1, 0)], [22, Vector2i(3, 0)], [12, Vector2i(1, 1)], [22, Vector2i(3, 1)], [13, Vector2i(0, 0)], [22, Vector2i(4, 0)], [13, Vector2i(0, 1)], [22, Vector2i(4, 1)], [13, Vector2i(1, 0)], [22, Vector2i(5, 0)], [13, Vector2i(1, 1)], [22, Vector2i(5, 1)], [14, Vector2i(0, 0)], [22, Vector2i(6, 0)], [14, Vector2i(0, 1)], [22, Vector2i(6, 1)], [14, Vector2i(1, 0)], [22, Vector2i(7, 0)], [14, Vector2i(1, 1)], [22, Vector2i(7, 1)], [15, Vector2i(0, 0)], [22, Vector2i(8, 0)], [15, Vector2i(0, 1)], [22, Vector2i(8, 1)], [15, Vector2i(1, 0)], [22, Vector2i(9, 0)], [15, Vector2i(1, 1)], [22, Vector2i(9, 1)], [16, Vector2i(0, 0)], [22, Vector2i(0, 2)], [16, Vector2i(0, 1)], [22, Vector2i(0, 3)], [16, Vector2i(1, 0)], [22, Vector2i(1, 2)], [16, Vector2i(1, 1)], [22, Vector2i(1, 3)], [17, Vector2i(0, 0)], [22, Vector2i(2, 2)], [17, Vector2i(0, 1)], [22, Vector2i(2, 3)], [17, Vector2i(1, 0)], [22, Vector2i(3, 2)], [17, Vector2i(1, 1)], [22, Vector2i(3, 3)], [18, Vector2i(0, 0)], [22, Vector2i(4, 2)], [18, Vector2i(0, 1)], [22, Vector2i(4, 3)], [18, Vector2i(1, 0)], [22, Vector2i(5, 2)], [18, Vector2i(1, 1)], [22, Vector2i(5, 3)], [19, Vector2i(0, 0)], [22, Vector2i(6, 2)], [19, Vector2i(0, 1)], [22, Vector2i(6, 3)], [19, Vector2i(1, 0)], [22, Vector2i(7, 2)], [19, Vector2i(1, 1)], [22, Vector2i(7, 3)], [20, Vector2i(0, 0)], [22, Vector2i(8, 2)], [20, Vector2i(0, 1)], [22, Vector2i(8, 3)], [20, Vector2i(1, 0)], [22, Vector2i(9, 2)], [20, Vector2i(1, 1)], [22, Vector2i(9, 3)], [21, Vector2i(0, 0)], [22, Vector2i(0, 4)], [21, Vector2i(0, 1)], [22, Vector2i(0, 5)], [21, Vector2i(1, 0)], [22, Vector2i(1, 4)], [21, Vector2i(1, 1)], [22, Vector2i(1, 5)]]
pattern_0 = SubResource("TileMapPattern_s62cf")
pattern_1 = SubResource("TileMapPattern_3yn03")

View File

@ -0,0 +1,4 @@
[gd_resource type="CompressedTexture2D" format=3 uid="uid://bthav6cae4fni"]
[resource]
load_path = "res://.godot/imported/base.png-b2215abe8c7e720db36c2fb00d361b79.ctex"

1
Asserts/icon.svg Normal file
View File

@ -0,0 +1 @@
<svg height="128" width="128" xmlns="http://www.w3.org/2000/svg"><rect x="2" y="2" width="124" height="124" rx="14" fill="#363d52" stroke="#212532" stroke-width="4"/><g transform="scale(.101) translate(122 122)"><g fill="#fff"><path d="M105 673v33q407 354 814 0v-33z"/><path 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" fill="#478cbf"/><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"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></g></svg>

After

Width:  |  Height:  |  Size: 949 B

37
Asserts/icon.svg.import Normal file
View File

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dffqd1ao0thh0"
path="res://.godot/imported/icon.svg-3f95d89ee926850c516495805de0c195.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Asserts/icon.svg"
dest_files=["res://.godot/imported/icon.svg-3f95d89ee926850c516495805de0c195.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

BIN
Asserts/pic/base.aseprite Normal file

Binary file not shown.

BIN
Asserts/pic/base.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 317 B

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://8j00nxif74gw"
path="res://.godot/imported/base.png-b2215abe8c7e720db36c2fb00d361b79.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Asserts/pic/base.png"
dest_files=["res://.godot/imported/base.png-b2215abe8c7e720db36c2fb00d361b79.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
Asserts/pic/chessboard.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dolq1l3fr7jep"
path="res://.godot/imported/chessboard.png-838556aeae0a8bec2d6765fe801da1f5.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Asserts/pic/chessboard.png"
dest_files=["res://.godot/imported/chessboard.png-838556aeae0a8bec2d6765fe801da1f5.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
Asserts/pic/col.aseprite Normal file

Binary file not shown.

BIN
Asserts/pic/col.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 B

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://d2evtffkyicvw"
path="res://.godot/imported/col.png-e153880b8e16fd94ae5361dcaf860c4e.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Asserts/pic/col.png"
dest_files=["res://.godot/imported/col.png-e153880b8e16fd94ae5361dcaf860c4e.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

1027
Asserts/pic/col.svg Normal file

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 58 KiB

View File

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c0n20m2jiqh0p"
path="res://.godot/imported/col.svg-0ffee336a198601f21d46ac9370e8b33.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Asserts/pic/col.svg"
dest_files=["res://.godot/imported/col.svg-0ffee336a198601f21d46ac9370e8b33.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

BIN
Asserts/pic/cross.aseprite Normal file

Binary file not shown.

BIN
Asserts/pic/cross.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 B

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dr5jdqbo4r6j7"
path="res://.godot/imported/cross.png-61b24edd52d348e6a2df810fe4611562.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Asserts/pic/cross.png"
dest_files=["res://.godot/imported/cross.png-61b24edd52d348e6a2df810fe4611562.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

Binary file not shown.

BIN
Asserts/pic/cross_0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 B

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cxlkcgt17ld3h"
path="res://.godot/imported/cross_0.png-f1b90147da6871245123302014c0a96a.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Asserts/pic/cross_0.png"
dest_files=["res://.godot/imported/cross_0.png-f1b90147da6871245123302014c0a96a.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

Binary file not shown.

BIN
Asserts/pic/cross_1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 B

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dq3vom8lgmclc"
path="res://.godot/imported/cross_1.png-c2e4f67ef355a344fece25b460d4a3d9.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Asserts/pic/cross_1.png"
dest_files=["res://.godot/imported/cross_1.png-c2e4f67ef355a344fece25b460d4a3d9.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

Binary file not shown.

BIN
Asserts/pic/cross_1_2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 B

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://detb77vbwc1e0"
path="res://.godot/imported/cross_1_2.png-e7369aafbf782a84cd02d7b0c4c08fb5.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Asserts/pic/cross_1_2.png"
dest_files=["res://.godot/imported/cross_1_2.png-e7369aafbf782a84cd02d7b0c4c08fb5.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

Binary file not shown.

BIN
Asserts/pic/cross_2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 B

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://hpoynvjiavth"
path="res://.godot/imported/cross_2.png-74689dd00eeb108339596295474720fb.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Asserts/pic/cross_2.png"
dest_files=["res://.godot/imported/cross_2.png-74689dd00eeb108339596295474720fb.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

Binary file not shown.

BIN
Asserts/pic/cross_plus.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 B

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://tr2jsudu2v4t"
path="res://.godot/imported/cross_plus.png-2fa59679e3e50d8e01930aaf83b96ad4.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Asserts/pic/cross_plus.png"
dest_files=["res://.godot/imported/cross_plus.png-2fa59679e3e50d8e01930aaf83b96ad4.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

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 B

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://iidoj8eejyel"
path="res://.godot/imported/cross_plus_1.png-e3f94469399618574ff23e3d0e24f6f0.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Asserts/pic/cross_plus_1.png"
dest_files=["res://.godot/imported/cross_plus_1.png-e3f94469399618574ff23e3d0e24f6f0.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

Binary file not shown.

BIN
Asserts/pic/cross_set.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 B

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b7ot4wbjukh3b"
path="res://.godot/imported/cross_set.png-fe860dfe18afc7f7f6a5db95b380d4f0.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Asserts/pic/cross_set.png"
dest_files=["res://.godot/imported/cross_set.png-fe860dfe18afc7f7f6a5db95b380d4f0.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

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 B

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://qdt3midw0lwa"
path="res://.godot/imported/cross_set_plus.png-053ef4f30063d45fedaba97cd4b90ee3.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Asserts/pic/cross_set_plus.png"
dest_files=["res://.godot/imported/cross_set_plus.png-053ef4f30063d45fedaba97cd4b90ee3.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

Binary file not shown.

BIN
Asserts/pic/eight_cross.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 309 B

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bnf7mbjy0dnof"
path="res://.godot/imported/eight_cross.png-ec3b7037c7e6f70719821e550766fe87.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Asserts/pic/eight_cross.png"
dest_files=["res://.godot/imported/eight_cross.png-ec3b7037c7e6f70719821e550766fe87.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
Asserts/pic/row.aseprite Normal file

Binary file not shown.

BIN
Asserts/pic/row.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 B

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://3c60m8fw5pqi"
path="res://.godot/imported/row.png-152afe43f242ba541b6fd5a83ddba791.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Asserts/pic/row.png"
dest_files=["res://.godot/imported/row.png-152afe43f242ba541b6fd5a83ddba791.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

8
Chinese_Chess.csproj Normal file
View File

@ -0,0 +1,8 @@
<Project Sdk="Godot.NET.Sdk/4.2.2">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework Condition=" '$(GodotTargetPlatform)' == 'android' ">net7.0</TargetFramework>
<TargetFramework Condition=" '$(GodotTargetPlatform)' == 'ios' ">net8.0</TargetFramework>
<EnableDynamicLoading>true</EnableDynamicLoading>
</PropertyGroup>
</Project>

25
Chinese_Chess.sln Normal file
View File

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.002.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Chinese_Chess", "Chinese_Chess.csproj", "{A43AD93A-A3A8-43DA-B00B-8ED7A960CCAC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A43AD93A-A3A8-43DA-B00B-8ED7A960CCAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A43AD93A-A3A8-43DA-B00B-8ED7A960CCAC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A43AD93A-A3A8-43DA-B00B-8ED7A960CCAC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A43AD93A-A3A8-43DA-B00B-8ED7A960CCAC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {1C372CC9-BDDA-4375-8F5E-506378E99FCC}
EndGlobalSection
EndGlobal

42
Main.cs Normal file
View File

@ -0,0 +1,42 @@
using Godot;
using System;
public partial class Main : Node2D
{
// public void ResizeChessboardToFitScreen()
// {
// var viewportSize = GetViewportRect().Size;
// var designSize = new Vector2(800, 800); // 设计时棋盘的尺寸,这里假设为正方形
// var screenAspectRatio = viewportSize.X / viewportSize.Y;
// var boardAspectRatio = designSize.X / designSize.Y;
// // 计算保持棋盘比例的缩放因子
// float scaleFactor;
// if (screenAspectRatio > boardAspectRatio)
// {
// // 屏幕更宽,按高度缩放
// scaleFactor = viewportSize.Y / designSize.Y;
// }
// else
// {
// // 屏幕更高或相等,按宽度缩放
// scaleFactor = viewportSize.X / designSize.X;
// }
// // 应用缩放
// GetNode<Node2D>("Chessboard").Scale = new Vector2(scaleFactor, scaleFactor);
// }
// Called when the node enters the scene tree for the first time.
public override void _Ready() {
// GetTree().Connect("screen_resized", ResizeChessboardToFitScreen);
// Button undo = GetNode<Button>("Undo");
// undo.Connect("pressed", (event) => {
// });
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta) {
}
}

30
Main.tscn Normal file
View File

@ -0,0 +1,30 @@
[gd_scene load_steps=3 format=3 uid="uid://boa4od72355o4"]
[ext_resource type="Script" path="res://Main.cs" id="1_h4cv2"]
[ext_resource type="PackedScene" uid="uid://b1tx7v3230wab" path="res://Scenes/Chessboard.tscn" id="2_bx85x"]
[node name="Main" type="Node2D"]
script = ExtResource("1_h4cv2")
[node name="Chessboard" parent="." instance=ExtResource("2_bx85x")]
position = Vector2(360, 660)
scale = Vector2(2.5, 2.5)
[node name="Undo" type="Button" parent="."]
offset_left = 200.0
offset_top = 50.0
offset_right = 300.0
offset_bottom = 150.0
theme_override_font_sizes/font_size = 32
text = "撤回"
[node name="ReInit" type="Button" parent="."]
offset_left = 450.0
offset_top = 50.0
offset_right = 550.0
offset_bottom = 150.0
theme_override_font_sizes/font_size = 32
text = "重开"
[connection signal="pressed" from="Undo" to="Chessboard" method="undo"]
[connection signal="pressed" from="ReInit" to="Chessboard" method="redo"]

18
Scenes/Chessboard.tscn Normal file
View File

@ -0,0 +1,18 @@
[gd_scene load_steps=4 format=3 uid="uid://b1tx7v3230wab"]
[ext_resource type="Script" path="res://Scripts/Entities/ChessBoard.cs" id="1_pjakt"]
[ext_resource type="TileSet" uid="uid://bibjj3ay65ral" path="res://Asserts/Chessboard.tres" id="1_ws3cq"]
[ext_resource type="Script" path="res://Scripts/Entities/ChessPiece.cs" id="3_26g24"]
[node name="Chessboard" type="Node2D"]
script = ExtResource("1_pjakt")
[node name="TileMap" type="TileMap" parent="."]
position = Vector2(-8, 184)
tile_set = ExtResource("1_ws3cq")
format = 2
layer_0/tile_data = PackedInt32Array(-327680, 262180, 1, -262146, 65572, 2, -327678, 65572, 268435458, -458752, 65572, 1342177282, -393218, 65572, 1, -458750, 65572, 1342177281, -196608, 262180, 536870912, -131074, 131108, 536870913, -196606, 131108, 805306369, -196604, 196644, 536870912, -196602, 196644, 536870912, -196600, 36, 536870913, -131076, 196644, 536870912, -131078, 196644, 536870912, -131080, 36, 805306369, -327676, 131108, 0, -327674, 131108, 0, -458748, 131108, 0, -262148, 131108, 0, -393220, 131108, 0, -262150, 131108, 0, -524294, 131108, 0, -524290, 131108, 0, -589822, 131108, 0, -589818, 131108, 0, -720896, 196644, 0, -720894, 196644, 0, -720892, 196644, 0, -720890, 196644, 0, -655362, 196644, 0, -655364, 196644, 0, -655366, 196644, 0, -458744, 196644, 1342177280, -262152, 196644, 1073741824, -393224, 196644, 1073741824, -655368, 36, 1610612737, -720888, 36, 1879048193, -393222, 196644, 1, -458746, 196644, 1, -327672, 196644, 1342177280, -524292, 196644, 1, -589824, 196644, 1, -589820, 196644, 1, -589816, 37, 1342177280, -524296, 37, 1073741824, -786440, 36, 1073741825, -786438, 196644, 536870912, -786436, 196644, 536870912, -786434, 196644, 536870912, -851968, 196644, 536870912, -851966, 196644, 536870912, -851964, 196644, 536870912, -851962, 196644, 536870912, -851960, 36, 1342177281, -917512, 37, 1610612736, -917510, 131108, 536870912, -917508, 196644, 536870913, -917506, 131108, 536870912, -983040, 196644, 536870913, -983038, 131108, 536870912, -983036, 196644, 536870913, -983034, 131108, 536870912, -983032, 37, 1879048192, -1048584, 196644, 1610612736, -1048582, 196644, 536870913, -1048580, 131108, 536870912, -1048578, 65572, 536870913, -1114112, 65572, 1879048194, -1114110, 65572, 1879048193, -1114108, 131108, 536870912, -1114106, 196644, 536870913, -1114104, 196644, 1879048192, -1179656, 196644, 1610612736, -1179654, 131108, 536870912, -1179652, 131108, 536870912, -1179650, 65572, 536870914, -1245184, 262180, 536870913, -1245182, 65572, 805306370, -1245180, 131108, 536870912, -1245178, 131108, 536870912, -1245176, 196644, 1879048192, -1310728, 36, 268435457, -1310726, 196644, 0, -1310724, 196644, 0, -1310722, 131108, 1, -1376256, 262180, 0, -1376254, 131108, 268435457, -1376252, 196644, 0, -1376250, 196644, 0, -1376248, 36, 1)
[node name="Sprite2D" type="Sprite2D" parent="."]
visible = false
script = ExtResource("3_26g24")

8
Scenes/Chesspiece.tscn Normal file
View File

@ -0,0 +1,8 @@
[gd_scene load_steps=2 format=3 uid="uid://gkbtavjf2273"]
[ext_resource type="Script" path="res://Scripts/Entities/ChessPiece.cs" id="2_cj0n3"]
[node name="Chesspiece" type="Node2D"]
[node name="Sprite2D" type="Sprite2D" parent="."]
script = ExtResource("2_cj0n3")

View File

@ -0,0 +1,100 @@
// Chessboard.cs
using Godot;
public partial class ChessBoard : Node2D {
VirtualBoard Board = null;
MoveRecords Records = null;
// Called when the node enters the scene tree for the first time.
public Vector2 selectedNodePos = Vector2.Inf;
public override void _Ready() {
Board = new VirtualBoard(this as Node);
Records = new MoveRecords(onUndoRecordCallback: (newNode, oldNode, newPos, oldPos) => {
GD.Print("Undo: ", newNode, "->", newNode, ":", newPos, "->", oldPos);
ChessPiece newPiece = newNode as ChessPiece;
ChessPiece oldPiece = oldNode as ChessPiece;
Board.MoveNode(oldPos, newPos);
if (newPiece != null) {
Board.InsertNode(newPiece, newPos);
}
// if (oldPiece != null) {
// Board.RemoveNode(oldPos);
// }
});
Board.InitChessBoard();
// this.AddChild();
}
public override void _Input(InputEvent @event) {
if (@event is InputEventMouseButton mouseEvent &&
mouseEvent.Pressed &&
mouseEvent.ButtonIndex == MouseButton.Left) {
// HandleMouseClick(GetGlobalTransformWithCanvas().AffineInverse() * mouseButton.Position);
// HandleMouseClick(GetLocalMousePosition());
ActionPos(
(PosTrans.transArrToPix.AffineInverse() *
GetLocalMousePosition()).Round()
);
}
}
public void ActionPos(Vector2 clickArrPos) {
if (VirtualBoard.ArrPosOutOfRange(clickArrPos)) return;
GD.Print($"{clickArrPos} mouse clicked");
ChessPiece NowChess = Board.getNodeFromBoard(clickArrPos) as ChessPiece;
ChessPiece SelChess = Board.getNodeFromBoard(selectedNodePos) as ChessPiece;
if (Vector2.Inf.Equals(selectedNodePos)) {
if (NowChess == null) {
return;
}
NowChess.Selected();
GD.Print($"{clickArrPos} is selected");
selectedNodePos = clickArrPos;
} else if (selectedNodePos == clickArrPos) {
if (SelChess != null) {
SelChess.DeSelected();
}
GD.Print($"{selectedNodePos} is deselected");
selectedNodePos = Vector2.Inf;
} else {
GD.Print($"{selectedNodePos} move to {clickArrPos}");
if (SelChess != null) {
SelChess.DeSelected();
GD.Print($"{selectedNodePos} is deselected");
}
Node NowNode;
if (NowChess != null) {
NowNode = NowChess.Duplicate();
Board.RemoveNode(clickArrPos);
} else {
NowNode = NowChess as Node;
}
Records.AddRecord(NowNode, SelChess, clickArrPos, selectedNodePos);
Board.MoveNode(clickArrPos, selectedNodePos);
selectedNodePos = Vector2.Inf;
// GD.Print($"End: {selectedNodePos} {SelChess} move to {clickArrPos} {NowChess}");
}
}
public void undo() {
Records.Undo();
}
public void redo() {
Records.Clear();
Board.Clear();
Board.InitChessBoard();
}
private void HandleMouseClick(Vector2 clickPosition) {
// 如果有棋子被选中,则进行后续操作
// if (nowSelectedChess == null) {
// seletedNode = null;
// } else if (nowSelectedChess != null && seletedNode != null) {
// if (seletedNode is ChessPiece chessPiece) MoveChess(arrayPos, chessPiece.arrPos);
// }
}
}

View File

@ -0,0 +1,77 @@
// Chesspiece.cs
using Godot;
public partial class ChessPiece : Sprite2D {
// 文字内容
[Export]
public string PieceLabel { get; set; } = null;
// 文字颜色(可导出以编辑器调整)
[Export]
public Color LabelColor { get; set; } = new Color("black");
private Vector2 textureSize;
private Label labelOfChessName;
private Vector2 arrPos = new Vector2(); // 注意这个坐标的非像素坐标而是棋盘坐标
public void movePos(Vector2 newPos) {
this.arrPos = newPos;
this.Position = PosTrans.transArrToPix * newPos;
}
public Vector2 getPos() {
return arrPos;
}
// 是否被选中
public bool isSelected = false;
Transform2D transToSeleted = new Transform2D(
new Vector2(1.2f, 0),
new Vector2(0, 1.2f),
new Vector2(0, 0)
);
public void Selected() {
if (isSelected) {
return;
}
this.Transform *= transToSeleted;
this.isSelected = true;
}
public void DeSelected() {
if (!isSelected) {
return;
}
this.Transform *= transToSeleted.AffineInverse();
this.isSelected = false;
}
// Called when the node enters the scene tree for the first time.
public override void _Ready() {
InitLabel();
}
private void InitLabel() {
// this.Texture.ResourcePath = "res://Asserts/ChesspieceBase.tres";
this.Texture = (Texture2D)ResourceLoader.Load("res://Asserts/ChesspieceBase.tres");
textureSize = this.Texture.GetSize();
Vector2 labalPosition = new(
-textureSize.X / 2,
-textureSize.Y / 2);
labelOfChessName = new Label {
Text = PieceLabel,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
Modulate = LabelColor,
Position = labalPosition,
Size = textureSize,
};
// labelOfChessName.SetAnchorsPreset(Control.LayoutPreset.FullRect);
AddChild(labelOfChessName);
}
interface IVarify {
bool CanMove(Vector2 newPosition);
}
}

View File

@ -0,0 +1,20 @@
// 帅/将 (General) - 代表双方的最高统帅。
// 子类名ChessGeneral
// 仕/士 (Advisor) - 保护帅/将的近身侍卫。
// 子类名ChessAdvisor
// 相/象 (Elephant) - 行动受限,走田字格,不能过河。
// 子类名ChessElephant
// 車/车 (Chariot) - 横竖移动,威力巨大。
// 子类名ChessChariot
// 馬/马 (Horse) - 走日字形,跳跃式移动。
// 子类名ChessHorse
// 砲/炮 (Cannon) - 需要隔子才能吃子,直线移动。
// 子类名ChessCannon
// 兵/卒 (Pawn) - 最基础的棋子,过河后可横移。
// 子类名ChessPawn

View File

@ -0,0 +1,57 @@
using System.Collections.Generic;
using System;
using Godot;
using System.Linq;
public class MoveRecords {
private readonly LinkedList<MoveRecord> records = new LinkedList<MoveRecord>(); // 使用队列替换栈
private readonly int maxRecords; // 记录上限
private Action<Node, Node, Vector2, Vector2> onAddRecordCallback; // 添加记录时的回调
private Action<Node, Node, Vector2, Vector2> onUndoRecordCallback; // 撤销记录时的回调
public MoveRecords(
Action<Node, Node, Vector2, Vector2> onAddRecordCallback = null,
Action<Node, Node, Vector2, Vector2> onUndoRecordCallback = null,
int maxRecords = 32) {
this.maxRecords = maxRecords;
this.onAddRecordCallback = onAddRecordCallback;
this.onUndoRecordCallback = onUndoRecordCallback;
}
public void AddRecord(Node newNode, Node oldNode, Vector2 newPos, Vector2 oldPos) {
// 达到记录上限时,移除最远的记录(队首元素)
if (records.Count >= maxRecords) {
records.RemoveFirst();
}
var record = new MoveRecord(newNode, oldNode, newPos, oldPos);
// 触发添加记录的回调
onAddRecordCallback?.Invoke(newNode, oldNode, newPos, oldPos);
// GD.Print("In func Addrecord: ", record.NewNode, "->", record.OldNode, ":", record.NewPos, "->", record.OldPos);
records.AddLast(record); // 将新记录加入队尾
}
public void Undo() {
if (records.Count == 0) return;
MoveRecord record = records.Last.Value; // 移除并获取队首的记录以执行撤销操作
records.RemoveLast();
// 触发撤销记录的回调
onUndoRecordCallback?.Invoke(record.NewNode, record.OldNode, record.NewPos, record.OldPos);
}
public void Clear() {
records.Clear();
}
private class MoveRecord {
public Node NewNode { get; }
public Node OldNode { get; }
public Vector2 NewPos { get; }
public Vector2 OldPos { get; }
public MoveRecord(Node newNode, Node oldNode, Vector2 newPos, Vector2 oldPos) {
this.NewNode = newNode;
this.OldNode = oldNode;
this.OldPos = oldPos;
this.NewPos = newPos;
}
}
}

View File

@ -0,0 +1,10 @@
using Godot;
public static class PosTrans {
private static readonly int pixGripSize = 32;
public static Transform2D transArrToPix = new(
new Vector2(pixGripSize, 0),
new Vector2(0, pixGripSize),
new Vector2(-4, -4.5f) * pixGripSize
);
}

View File

@ -0,0 +1,316 @@
using System.Dynamic;
using Godot;
class VirtualBoard {
private static readonly int boradRows = 9;
private static readonly int boradCols = 10;
private readonly Node BoardRoot;
private readonly Node[,] nodesBorad = new Node[boradRows, boradCols];
public static bool ArrPosOutOfRange(Vector2 arrayPos) {
return arrayPos.X < 0 || arrayPos.X >= boradRows || arrayPos.Y < 0 || arrayPos.Y >= boradCols;
}
public Node getNodeFromBoard(Vector2 arrayPos) {
if (ArrPosOutOfRange(arrayPos)) return null;
return nodesBorad[(int)arrayPos.X, (int)arrayPos.Y];
}
public void setNodeToBoard(Vector2 arrayPos, Node node) {
if (ArrPosOutOfRange(arrayPos)) return;
nodesBorad[(int)arrayPos.X, (int)arrayPos.Y] = node;
}
public VirtualBoard(Node root = null) {
//?? //GetTree().CurrentScene; // 如果未提供root默认为当前场景
BoardRoot = root;
}
public bool MoveNode(Vector2 newPos, Vector2 oldPos) {
if (ArrPosOutOfRange(newPos) || ArrPosOutOfRange(oldPos)) {
return false;
}
if (getNodeFromBoard(newPos) != null) {
return false;
}
if (getNodeFromBoard(oldPos) is ChessPiece chessPiece) {
chessPiece.movePos(newPos);
}
setNodeToBoard(newPos, getNodeFromBoard(oldPos));
setNodeToBoard(oldPos, null);
return true;
}
public bool RemoveNode(Vector2 arrayPos) {
if (ArrPosOutOfRange(arrayPos)) return false;
if (getNodeFromBoard(arrayPos) is ChessPiece chessPiece) {
chessPiece.QueueFree();
}
setNodeToBoard(arrayPos, null);
return true;
}
public void InsertNode(ChessPiece chess, Vector2 arrayPos) {
chess.Position = PosTrans.transArrToPix * arrayPos;
setNodeToBoard(arrayPos, chess);
BoardRoot.AddChild(chess);
}
public void Clear() {
foreach (var node in BoardRoot.GetChildren()) {
if (node is ChessPiece chessPiece) {
chessPiece.QueueFree();
}
}
}
// using Godot;
// public enum ChessType
// {
// Carriage,
// Horse,
// Elephant,
// Advisor,
// General,
// Cannon,
// Pawn
// }
// public class VirtualBoard
// {
// // ...其他原有成员变量...
// public VirtualBoard(Node root = null)
// {
// BoardRoot = root ?? GetTree().CurrentScene; // 如果未提供root默认为当前场景
// }
// public void InitChessBoard()
// {
// // 定义黑色和红色棋子的初始位置和类型
// var positions = new (Vector2 position, ChessType type)[]
// {
// // 黑方棋子初始化...
// // 示例省略具体位置和类型,你需要根据实际情况填写
// // (new Vector2(x, y), ChessType.Pawn),
// // 红方棋子初始化...
// // 同上
// };
// // 初始化棋子
// foreach (var (position, type) in positions)
// {
// var color = position.Y == 0 ? new Color("black") : new Color("red"); // 根据行判断颜色
// var piece = CreateChessPiece(type, color);
// InsertChess(piece, position);
// }
// }
// private ChessPiece CreateChessPiece(ChessType type, Color labelColor)
// {
// // 根据ChessType创建对应的棋子实例并设置Label和颜色
// // 这里需要你实现具体的逻辑例如switch case或映射表来决定创建哪种棋子
// // 返回创建的棋子实例
// }
// // ...其他原有方法...
// }
public void InitChessBoard() {
InsertNode(new ChessPiece
{
PieceLabel = "车",
LabelColor = new Color("black"),
}, new Vector2(0, 0));
InsertNode(new ChessPiece
{
PieceLabel = "马",
LabelColor = new Color("black"),
}, new Vector2(1, 0));
InsertNode(new ChessPiece
{
PieceLabel = "象",
LabelColor = new Color("black"),
}, new Vector2(2, 0));
InsertNode(new ChessPiece
{
PieceLabel = "士",
LabelColor = new Color("black"),
}, new Vector2(3, 0));
InsertNode(new ChessPiece
{
PieceLabel = "将",
LabelColor = new Color("black"),
}, new Vector2(4, 0));
InsertNode(new ChessPiece
{
PieceLabel = "士",
LabelColor = new Color("black"),
}, new Vector2(5, 0));
InsertNode(new ChessPiece
{
PieceLabel = "象",
LabelColor = new Color("black"),
}, new Vector2(6, 0));
InsertNode(new ChessPiece
{
PieceLabel = "马",
LabelColor = new Color("black"),
}, new Vector2(7, 0));
InsertNode(new ChessPiece
{
PieceLabel = "车",
LabelColor = new Color("black"),
}, new Vector2(8, 0));
InsertNode(new ChessPiece
{
PieceLabel = "炮",
LabelColor = new Color("black"),
}, new Vector2(1, 2));
InsertNode(new ChessPiece
{
PieceLabel = "炮",
LabelColor = new Color("black"),
}, new Vector2(7, 2));
InsertNode(new ChessPiece
{
PieceLabel = "卒",
LabelColor = new Color("black"),
}, new Vector2(0, 3));
InsertNode(new ChessPiece
{
PieceLabel = "卒",
LabelColor = new Color("black"),
}, new Vector2(2, 3));
InsertNode(new ChessPiece
{
PieceLabel = "卒",
LabelColor = new Color("black"),
}, new Vector2(4, 3));
InsertNode(new ChessPiece
{
PieceLabel = "卒",
LabelColor = new Color("black"),
}, new Vector2(6, 3));
InsertNode(new ChessPiece
{
PieceLabel = "卒",
LabelColor = new Color("black"),
}, new Vector2(8, 3));
// -----------------------------------
InsertNode(new ChessPiece
{
PieceLabel = "车",
LabelColor = new Color("red"),
}, new Vector2(0, 9));
InsertNode(new ChessPiece
{
PieceLabel = "马",
LabelColor = new Color("red"),
}, new Vector2(1, 9));
InsertNode(new ChessPiece
{
PieceLabel = "象",
LabelColor = new Color("red"),
}, new Vector2(2, 9));
InsertNode(new ChessPiece
{
PieceLabel = "士",
LabelColor = new Color("red"),
}, new Vector2(3, 9));
InsertNode(new ChessPiece
{
PieceLabel = "将",
LabelColor = new Color("red"),
}, new Vector2(4, 9));
InsertNode(new ChessPiece
{
PieceLabel = "士",
LabelColor = new Color("red"),
}, new Vector2(5, 9));
InsertNode(new ChessPiece
{
PieceLabel = "象",
LabelColor = new Color("red"),
}, new Vector2(6, 9));
InsertNode(new ChessPiece
{
PieceLabel = "马",
LabelColor = new Color("red"),
}, new Vector2(7, 9));
InsertNode(new ChessPiece
{
PieceLabel = "车",
LabelColor = new Color("red"),
}, new Vector2(8, 9));
InsertNode(new ChessPiece
{
PieceLabel = "炮",
LabelColor = new Color("red"),
}, new Vector2(1, 7));
InsertNode(new ChessPiece
{
PieceLabel = "炮",
LabelColor = new Color("red"),
}, new Vector2(7, 7));
InsertNode(new ChessPiece
{
PieceLabel = "卒",
LabelColor = new Color("red"),
}, new Vector2(0, 6));
InsertNode(new ChessPiece
{
PieceLabel = "卒",
LabelColor = new Color("red"),
}, new Vector2(2, 6));
InsertNode(new ChessPiece
{
PieceLabel = "卒",
LabelColor = new Color("red"),
}, new Vector2(4, 6));
InsertNode(new ChessPiece
{
PieceLabel = "卒",
LabelColor = new Color("red"),
}, new Vector2(6, 6));
InsertNode(new ChessPiece
{
PieceLabel = "卒",
LabelColor = new Color("red"),
}, new Vector2(8, 6));
}
}

379
export_presets.cfg Normal file
View File

@ -0,0 +1,379 @@
[preset.0]
name="Windows Desktop"
platform="Windows Desktop"
runnable=false
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="bin/Chinese_Chess.exe"
encryption_include_filters=""
encryption_exclude_filters=""
encrypt_pck=false
encrypt_directory=false
[preset.0.options]
custom_template/debug=""
custom_template/release=""
debug/export_console_wrapper=1
binary_format/embed_pck=false
texture_format/bptc=true
texture_format/s3tc=true
texture_format/etc=false
texture_format/etc2=false
binary_format/architecture="x86_64"
codesign/enable=false
codesign/timestamp=true
codesign/timestamp_server_url=""
codesign/digest_algorithm=1
codesign/description=""
codesign/custom_options=PackedStringArray()
application/modify_resources=true
application/icon=""
application/console_wrapper_icon=""
application/icon_interpolation=4
application/file_version=""
application/product_version=""
application/company_name=""
application/product_name=""
application/file_description=""
application/copyright=""
application/trademarks=""
application/export_angle=0
ssh_remote_deploy/enabled=false
ssh_remote_deploy/host="user@host_ip"
ssh_remote_deploy/port="22"
ssh_remote_deploy/extra_args_ssh=""
ssh_remote_deploy/extra_args_scp=""
ssh_remote_deploy/run_script="Expand-Archive -LiteralPath '{temp_dir}\\{archive_name}' -DestinationPath '{temp_dir}'
$action = New-ScheduledTaskAction -Execute '{temp_dir}\\{exe_name}' -Argument '{cmd_args}'
$trigger = New-ScheduledTaskTrigger -Once -At 00:00
$settings = New-ScheduledTaskSettingsSet
$task = New-ScheduledTask -Action $action -Trigger $trigger -Settings $settings
Register-ScheduledTask godot_remote_debug -InputObject $task -Force:$true
Start-ScheduledTask -TaskName godot_remote_debug
while (Get-ScheduledTask -TaskName godot_remote_debug | ? State -eq running) { Start-Sleep -Milliseconds 100 }
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue"
ssh_remote_deploy/cleanup_script="Stop-ScheduledTask -TaskName godot_remote_debug -ErrorAction:SilentlyContinue
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue
Remove-Item -Recurse -Force '{temp_dir}'"
dotnet/include_scripts_content=false
dotnet/include_debug_symbols=true
dotnet/embed_build_outputs=false
[preset.1]
name="Android"
platform="Android"
runnable=true
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="bin/Chinese_Chess.apk"
encryption_include_filters=""
encryption_exclude_filters=""
encrypt_pck=false
encrypt_directory=false
[preset.1.options]
custom_template/debug=""
custom_template/release=""
gradle_build/use_gradle_build=false
gradle_build/export_format=0
gradle_build/min_sdk=""
gradle_build/target_sdk=""
architectures/armeabi-v7a=false
architectures/arm64-v8a=true
architectures/x86=false
architectures/x86_64=false
version/code=1
version/name=""
package/unique_name="com.example.$genname"
package/name=""
package/signed=true
package/app_category=2
package/retain_data_on_uninstall=false
package/exclude_from_recents=false
package/show_in_android_tv=false
package/show_in_app_library=true
package/show_as_launcher_app=false
launcher_icons/main_192x192=""
launcher_icons/adaptive_foreground_432x432=""
launcher_icons/adaptive_background_432x432=""
graphics/opengl_debug=false
xr_features/xr_mode=0
screen/immersive_mode=true
screen/support_small=true
screen/support_normal=true
screen/support_large=true
screen/support_xlarge=true
user_data_backup/allow=false
command_line/extra_args=""
apk_expansion/enable=false
apk_expansion/SALT=""
apk_expansion/public_key=""
permissions/custom_permissions=PackedStringArray()
permissions/access_checkin_properties=false
permissions/access_coarse_location=false
permissions/access_fine_location=false
permissions/access_location_extra_commands=false
permissions/access_mock_location=false
permissions/access_network_state=false
permissions/access_surface_flinger=false
permissions/access_wifi_state=false
permissions/account_manager=false
permissions/add_voicemail=false
permissions/authenticate_accounts=false
permissions/battery_stats=false
permissions/bind_accessibility_service=false
permissions/bind_appwidget=false
permissions/bind_device_admin=false
permissions/bind_input_method=false
permissions/bind_nfc_service=false
permissions/bind_notification_listener_service=false
permissions/bind_print_service=false
permissions/bind_remoteviews=false
permissions/bind_text_service=false
permissions/bind_vpn_service=false
permissions/bind_wallpaper=false
permissions/bluetooth=false
permissions/bluetooth_admin=false
permissions/bluetooth_privileged=false
permissions/brick=false
permissions/broadcast_package_removed=false
permissions/broadcast_sms=false
permissions/broadcast_sticky=false
permissions/broadcast_wap_push=false
permissions/call_phone=false
permissions/call_privileged=false
permissions/camera=false
permissions/capture_audio_output=false
permissions/capture_secure_video_output=false
permissions/capture_video_output=false
permissions/change_component_enabled_state=false
permissions/change_configuration=false
permissions/change_network_state=false
permissions/change_wifi_multicast_state=false
permissions/change_wifi_state=false
permissions/clear_app_cache=false
permissions/clear_app_user_data=false
permissions/control_location_updates=false
permissions/delete_cache_files=false
permissions/delete_packages=false
permissions/device_power=false
permissions/diagnostic=false
permissions/disable_keyguard=false
permissions/dump=false
permissions/expand_status_bar=false
permissions/factory_test=false
permissions/flashlight=false
permissions/force_back=false
permissions/get_accounts=false
permissions/get_package_size=false
permissions/get_tasks=false
permissions/get_top_activity_info=false
permissions/global_search=false
permissions/hardware_test=false
permissions/inject_events=false
permissions/install_location_provider=false
permissions/install_packages=false
permissions/install_shortcut=false
permissions/internal_system_window=false
permissions/internet=false
permissions/kill_background_processes=false
permissions/location_hardware=false
permissions/manage_accounts=false
permissions/manage_app_tokens=false
permissions/manage_documents=false
permissions/manage_external_storage=false
permissions/master_clear=false
permissions/media_content_control=false
permissions/modify_audio_settings=false
permissions/modify_phone_state=false
permissions/mount_format_filesystems=false
permissions/mount_unmount_filesystems=false
permissions/nfc=false
permissions/persistent_activity=false
permissions/post_notifications=false
permissions/process_outgoing_calls=false
permissions/read_calendar=false
permissions/read_call_log=false
permissions/read_contacts=false
permissions/read_external_storage=false
permissions/read_frame_buffer=false
permissions/read_history_bookmarks=false
permissions/read_input_state=false
permissions/read_logs=false
permissions/read_phone_state=false
permissions/read_profile=false
permissions/read_sms=false
permissions/read_social_stream=false
permissions/read_sync_settings=false
permissions/read_sync_stats=false
permissions/read_user_dictionary=false
permissions/reboot=false
permissions/receive_boot_completed=false
permissions/receive_mms=false
permissions/receive_sms=false
permissions/receive_wap_push=false
permissions/record_audio=false
permissions/reorder_tasks=false
permissions/restart_packages=false
permissions/send_respond_via_message=false
permissions/send_sms=false
permissions/set_activity_watcher=false
permissions/set_alarm=false
permissions/set_always_finish=false
permissions/set_animation_scale=false
permissions/set_debug_app=false
permissions/set_orientation=false
permissions/set_pointer_speed=false
permissions/set_preferred_applications=false
permissions/set_process_limit=false
permissions/set_time=false
permissions/set_time_zone=false
permissions/set_wallpaper=false
permissions/set_wallpaper_hints=false
permissions/signal_persistent_processes=false
permissions/status_bar=false
permissions/subscribed_feeds_read=false
permissions/subscribed_feeds_write=false
permissions/system_alert_window=false
permissions/transmit_ir=false
permissions/uninstall_shortcut=false
permissions/update_device_stats=false
permissions/use_credentials=false
permissions/use_sip=false
permissions/vibrate=false
permissions/wake_lock=false
permissions/write_apn_settings=false
permissions/write_calendar=false
permissions/write_call_log=false
permissions/write_contacts=false
permissions/write_external_storage=false
permissions/write_gservices=false
permissions/write_history_bookmarks=false
permissions/write_profile=false
permissions/write_secure_settings=false
permissions/write_settings=false
permissions/write_sms=false
permissions/write_social_stream=false
permissions/write_sync_settings=false
permissions/write_user_dictionary=false
dotnet/include_scripts_content=false
dotnet/include_debug_symbols=true
dotnet/embed_build_outputs=false
[preset.2]
name="macOS"
platform="macOS"
runnable=true
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path=""
encryption_include_filters=""
encryption_exclude_filters=""
encrypt_pck=false
encrypt_directory=false
[preset.2.options]
export/distribution_type=1
binary_format/architecture="universal"
custom_template/debug=""
custom_template/release=""
debug/export_console_wrapper=1
application/icon=""
application/icon_interpolation=4
application/bundle_identifier=""
application/signature=""
application/app_category="Games"
application/short_version=""
application/version=""
application/copyright=""
application/copyright_localized={}
application/min_macos_version="10.12"
application/export_angle=0
display/high_res=true
xcode/platform_build="14C18"
xcode/sdk_version="13.1"
xcode/sdk_build="22C55"
xcode/sdk_name="macosx13.1"
xcode/xcode_version="1420"
xcode/xcode_build="14C18"
codesign/codesign=1
codesign/installer_identity=""
codesign/apple_team_id=""
codesign/identity=""
codesign/entitlements/custom_file=""
codesign/entitlements/allow_jit_code_execution=false
codesign/entitlements/allow_unsigned_executable_memory=false
codesign/entitlements/allow_dyld_environment_variables=false
codesign/entitlements/disable_library_validation=false
codesign/entitlements/audio_input=false
codesign/entitlements/camera=false
codesign/entitlements/location=false
codesign/entitlements/address_book=false
codesign/entitlements/calendars=false
codesign/entitlements/photos_library=false
codesign/entitlements/apple_events=false
codesign/entitlements/debugging=false
codesign/entitlements/app_sandbox/enabled=false
codesign/entitlements/app_sandbox/network_server=false
codesign/entitlements/app_sandbox/network_client=false
codesign/entitlements/app_sandbox/device_usb=false
codesign/entitlements/app_sandbox/device_bluetooth=false
codesign/entitlements/app_sandbox/files_downloads=0
codesign/entitlements/app_sandbox/files_pictures=0
codesign/entitlements/app_sandbox/files_music=0
codesign/entitlements/app_sandbox/files_movies=0
codesign/entitlements/app_sandbox/files_user_selected=0
codesign/entitlements/app_sandbox/helper_executables=[]
codesign/custom_options=PackedStringArray()
notarization/notarization=0
privacy/microphone_usage_description=""
privacy/microphone_usage_description_localized={}
privacy/camera_usage_description=""
privacy/camera_usage_description_localized={}
privacy/location_usage_description=""
privacy/location_usage_description_localized={}
privacy/address_book_usage_description=""
privacy/address_book_usage_description_localized={}
privacy/calendar_usage_description=""
privacy/calendar_usage_description_localized={}
privacy/photos_library_usage_description=""
privacy/photos_library_usage_description_localized={}
privacy/desktop_folder_usage_description=""
privacy/desktop_folder_usage_description_localized={}
privacy/documents_folder_usage_description=""
privacy/documents_folder_usage_description_localized={}
privacy/downloads_folder_usage_description=""
privacy/downloads_folder_usage_description_localized={}
privacy/network_volumes_usage_description=""
privacy/network_volumes_usage_description_localized={}
privacy/removable_volumes_usage_description=""
privacy/removable_volumes_usage_description_localized={}
ssh_remote_deploy/enabled=false
ssh_remote_deploy/host="user@host_ip"
ssh_remote_deploy/port="22"
ssh_remote_deploy/extra_args_ssh=""
ssh_remote_deploy/extra_args_scp=""
ssh_remote_deploy/run_script="#!/usr/bin/env bash
unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\"
open \"{temp_dir}/{exe_name}.app\" --args {cmd_args}"
ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash
kill $(pgrep -x -f \"{temp_dir}/{exe_name}.app/Contents/MacOS/{exe_name} {cmd_args}\")
rm -rf \"{temp_dir}\""
dotnet/include_scripts_content=false
dotnet/include_debug_symbols=true
dotnet/embed_build_outputs=false

33
project.godot Normal file
View File

@ -0,0 +1,33 @@
; 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="Chinese_Chess"
run/main_scene="res://Main.tscn"
config/features=PackedStringArray("4.2", "C#", "Mobile")
config/icon="res://Asserts/icon.svg"
[display]
window/size/viewport_width=720
window/size/viewport_height=1280
window/size/always_on_top=true
window/stretch/mode="viewport"
window/handheld/orientation=1
[dotnet]
project/assembly_name="Chinese_Chess"
[rendering]
renderer/rendering_method="mobile"
textures/vram_compression/import_etc2_astc=true