build(project): 更新项目配置和代码结构
- 升级 Godot.NET.Sdk 版本至 4.4.0 - 更新场景文件中的资源引用方式 - 调整部分代码逻辑和数据结构 - 更新项目配置文件
This commit is contained in:
@ -23,7 +23,7 @@ public partial class ChessGame : Node2D {
|
||||
.Text = global.GlobalData["player_color"].AsString();
|
||||
LineEdit turnSideEdit = GetNode<LineEdit>("Control/VBoxContainer/MarginContainer3/HFlowContainer/LineEdit2");
|
||||
turnSideEdit.Text = "red";
|
||||
GD.PrintErr("ChessGame ", global.RPClient.GetUserId(), ":",global.GlobalData["player_color"]);
|
||||
GD.Print("ChessGame uid:", global.RPClient.GetUserId(), " color:",global.GlobalData["player_color"]);
|
||||
|
||||
dialog = new ConfirmationDialog {
|
||||
DialogAutowrap = true,
|
||||
@ -40,13 +40,7 @@ public partial class ChessGame : Node2D {
|
||||
sideOpposite = ChessCore.TurnsSideType.Red;
|
||||
}
|
||||
|
||||
// if (isSession) {
|
||||
// Game = new(ChessCore.Mode.MultiMode, sideSelf);
|
||||
// } else {
|
||||
// Game = new(ChessCore.Mode.SingleMode, sideSelf);
|
||||
// }
|
||||
Game = new(isSession ? ChessCore.Mode.MultiMode : ChessCore.Mode.SingleMode, sideSelf, board);
|
||||
Game.Init();
|
||||
|
||||
board.OnStepsChanged += (sender, e) => {
|
||||
turnSideEdit.Text = Game.GetTurnsType() == ChessCore.TurnsSideType.Red ? "red" : "black";
|
||||
|
1
Scripts/Controllers/ChessGame.cs.uid
Normal file
1
Scripts/Controllers/ChessGame.cs.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://cqgctouhh8qok
|
1
Scripts/Controllers/GameLobby.cs.uid
Normal file
1
Scripts/Controllers/GameLobby.cs.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://cn273e4u256r
|
1
Scripts/Controllers/Setting.cs.uid
Normal file
1
Scripts/Controllers/Setting.cs.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://71ril3nh84rw
|
1
Scripts/Entities/ChessBoard.cs.uid
Normal file
1
Scripts/Entities/ChessBoard.cs.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://dmc012tt32dkl
|
1
Scripts/Entities/ChessPiece.cs.uid
Normal file
1
Scripts/Entities/ChessPiece.cs.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://c8eafskfpuesm
|
1
Scripts/Global.cs.uid
Normal file
1
Scripts/Global.cs.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://dd84v12101t1n
|
1
Scripts/Lib/RPClient.cs.uid
Normal file
1
Scripts/Lib/RPClient.cs.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://piu7vpl63m2m
|
1
Scripts/Lib/RPHelper.cs.uid
Normal file
1
Scripts/Lib/RPHelper.cs.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://bg8nobv3n6cek
|
1
Scripts/Lib/RPMessage.cs.uid
Normal file
1
Scripts/Lib/RPMessage.cs.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://bunvpv6p54l78
|
1
Scripts/Lib/gdws.cs.uid
Normal file
1
Scripts/Lib/gdws.cs.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://bsali4mwx62tt
|
1
Scripts/Src/AbstractBoard.cs.uid
Normal file
1
Scripts/Src/AbstractBoard.cs.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://d1xim7v5bes7j
|
1
Scripts/Src/AbstractPiece.cs.uid
Normal file
1
Scripts/Src/AbstractPiece.cs.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://cxlgd4kjfae7i
|
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
|
1
Scripts/Src/IBoard.cs.uid
Normal file
1
Scripts/Src/IBoard.cs.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://cgbntdvka6y2f
|
1
Scripts/Src/IPiece.cs.uid
Normal file
1
Scripts/Src/IPiece.cs.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://dr1tx5gmpvy2h
|
1
Scripts/Src/Vector.cs.uid
Normal file
1
Scripts/Src/Vector.cs.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://btjgh7imdrha1
|
1
Scripts/Utilities/GodotConfigManager.cs.uid
Normal file
1
Scripts/Utilities/GodotConfigManager.cs.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://qfml5c031hb0
|
Reference in New Issue
Block a user