build(project): 更新项目配置和代码结构
- 升级 Godot.NET.Sdk 版本至 4.4.0 - 更新场景文件中的资源引用方式 - 调整部分代码逻辑和数据结构 - 更新项目配置文件
This commit is contained in:
1
Scripts/Src/ChineseChess/CCBoard.cs.uid
Normal file
1
Scripts/Src/ChineseChess/CCBoard.cs.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://dpcteo12eebjn
|
@ -61,6 +61,8 @@ public class ChessCore {
|
||||
case Mode.DebugMode:
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
public void Init() {
|
||||
|
1
Scripts/Src/ChineseChess/CCMain.cs.uid
Normal file
1
Scripts/Src/ChineseChess/CCMain.cs.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://sgx62hxlp6fr
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
1
Scripts/Src/ChineseChess/CCPiece.cs.uid
Normal file
1
Scripts/Src/ChineseChess/CCPiece.cs.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://b6ajoxcxs66n1
|
1
Scripts/Src/ChineseChess/CCPlayer.cs.uid
Normal file
1
Scripts/Src/ChineseChess/CCPlayer.cs.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://blpqjd37p3r38
|
@ -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));
|
||||
|
1
Scripts/Src/ChineseChess/CCTypes.cs.uid
Normal file
1
Scripts/Src/ChineseChess/CCTypes.cs.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://mv1sbsok7q3k
|
Reference in New Issue
Block a user