build(project): 更新项目配置和代码结构

- 升级 Godot.NET.Sdk 版本至 4.4.0
- 更新场景文件中的资源引用方式
- 调整部分代码逻辑和数据结构
- 更新项目配置文件
This commit is contained in:
ZZY
2025-04-21 21:49:03 +08:00
parent e16f76e11f
commit b27abb55a2
36 changed files with 109 additions and 75 deletions

View File

@ -0,0 +1 @@
uid://dpcteo12eebjn

View File

@ -61,6 +61,8 @@ public class ChessCore {
case Mode.DebugMode:
throw new NotImplementedException();
}
Init();
}
public void Init() {

View File

@ -0,0 +1 @@
uid://sgx62hxlp6fr

View File

@ -75,11 +75,11 @@ public class CCPiece : AbstractPiece {
return board.IsPosOutOfRange(Local2Global(pos));
}
protected CCPiece? GetRecursivePieceLocal(Vector2I origin, Vector2I pos) {
protected (CCPiece?, Vector2I) GetRecursivePieceLocal(Vector2I origin, Vector2I pos) {
Vector2I with = origin + pos;
while (!IsPosOutOfRangeLocal(with) && GetCCPieceLocal(with) == null) {
with += pos;
}
return GetCCPieceLocal(with);
return (GetCCPieceLocal(with), with);
}
}

View File

@ -0,0 +1 @@
uid://b6ajoxcxs66n1

View File

@ -0,0 +1 @@
uid://blpqjd37p3r38

View File

@ -14,18 +14,22 @@ public class CCGeneral : CCPiece {
}
public override List<Vector2I> CanMoveAllPosSelf() {
List<Vector2I> list = new() {
List<Vector2I> list = [
new(1, 0),
new(-1, 0),
new(0, 1),
new(0, -1),
};
];
// 移除不符合条件的元素
list.RemoveAll(item =>
localPos.X + item.X > 1 || localPos.X + item.X < -1 ||
localPos.Y + item.Y > 2 || localPos.Y + item.Y < 0
|| GetRecursivePieceLocal(localPos + item, new(0, 1)) is CCGeneral);
localPos.Y + item.Y > 2 || localPos.Y + item.Y < 0);
(var piece, Vector2I pos) = GetRecursivePieceLocal(localPos, new(0, 1));
if (piece is CCGeneral) {
list.Add(pos);
}
return list;
}
}
@ -41,12 +45,12 @@ public class CCAdvisor : CCPiece {
}
public override List<Vector2I> CanMoveAllPosSelf() {
List<Vector2I> list = new() {
List<Vector2I> list = [
new(1, 1),
new(-1, 1),
new(1, -1),
new(-1, -1),
};
];
// 移除不符合条件的元素
list.RemoveAll(item =>
@ -68,12 +72,12 @@ public class CCElephant : CCPiece {
}
public override List<Vector2I> CanMoveAllPosSelf() {
List<Vector2I> list = new() {
List<Vector2I> list = [
new(2, 2),
new(-2, 2),
new(2, -2),
new(-2, -2),
};
];
list.RemoveAll(item => IsPosOutOfRangeLocal(localPos + item));
// 移除不符合条件的元素
@ -95,7 +99,7 @@ public class CCHorse : CCPiece {
}
public override List<Vector2I> CanMoveAllPosSelf() {
List<Vector2I> list = new () {
List<Vector2I> list = [
new Vector2I(1, 2),
new Vector2I(1, -2),
new Vector2I(2, 1),
@ -104,7 +108,7 @@ public class CCHorse : CCPiece {
new Vector2I(-1, 2),
new Vector2I(-2, -1),
new Vector2I(-2, 1),
};
];
list.RemoveAll(item => IsPosOutOfRangeLocal(localPos + item));
list.RemoveAll(item => {
@ -135,7 +139,7 @@ public class CCChariot : CCPiece {
}
public override List<Vector2I> CanMoveAllPosSelf() {
List<Vector2I> list = new ();
List<Vector2I> list = [];
void func(Vector2I added) {
Vector2I ptr = new(localPos);
@ -171,7 +175,7 @@ public class CCCannon : CCPiece {
}
public override List<Vector2I> CanMoveAllPosSelf() {
List<Vector2I> list = new ();
List<Vector2I> list = [];
void func(Vector2I added) {
Vector2I ptr = new(localPos);
@ -212,11 +216,11 @@ public class CCPawn : CCPiece {
}
public override List<Vector2I> CanMoveAllPosSelf() {
List<Vector2I> list = new () {
List<Vector2I> list = [
new(0, 1),
new(1, 0),
new(-1, 0),
};
];
list.RemoveAll(item => IsPosOutOfRangeLocal(localPos + item));
list.RemoveAll(item => localPos.Y <= 4 && item != new Vector2I(0, 1));

View File

@ -0,0 +1 @@
uid://mv1sbsok7q3k