Commit 2f94cdc2 authored by 刘家荣's avatar 刘家荣 💬
Browse files

Adjust UI

parent 98d06dd4
Loading
Loading
Loading
Loading
+1 −1

File changed.

Preview size limit exceeded, changes collapsed.

+2 −11
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ public class ChessboardCom extends JComponent {

		//Main Chessboard Init
		int spacingLength = SQUARE_SIZE / 12;
		SquareCom.ALIVE_CHESS_FONT = new Font("Rockwell", Font.BOLD, (int) ((SQUARE_SIZE - 2 * spacingLength) * 0.55));
		SquareCom.ALIVE_CHESS_FONT = new Font("Microsoft YaHei", Font.PLAIN, (int) ((SQUARE_SIZE - 2 * spacingLength) * 0.55));
		for (int i = 0; i < Chessboard.ROW_SIZE; i++) {
			for (int j = 0; j < Chessboard.COL_SIZE; j++) {
				Site site = new Site(ChessColor.NONE, i, j);
@@ -52,7 +52,7 @@ public class ChessboardCom extends JComponent {
		}

		//SideStack Init
		SquareCom.DEAD_CHESS_FONT = new Font("Rockwell", Font.BOLD, (int) (sideWidth / (SideStack.COL_SIZE - 2) * 0.55));
		SquareCom.DEAD_CHESS_FONT = new Font("Microsoft YaHei", Font.PLAIN, (int) (sideWidth / (SideStack.COL_SIZE - 2) * 0.55));
		int sideHeight = sideWidth * (SideStack.ROW_SIZE) / (SideStack.COL_SIZE - 2);
		this.sideStackComs = new SideStackCom[]{
				new SideStackCom(
@@ -151,13 +151,4 @@ public class ChessboardCom extends JComponent {
	public static Point evalPoint(GridPoint gridPoint) {
		return evalPoint(gridPoint.getY(), gridPoint.getX());
	}

	/**
	 * 通过GameController调用该方法
	 *
	 * @param chessData
	 */
	public void loadGame(List<String> chessData) {
		chessData.forEach(System.out::println);
	}
}
+6 −4
Original line number Diff line number Diff line
@@ -19,7 +19,9 @@ import java.awt.event.MouseEvent;
 */
public class SquareCom extends JComponent {

	private static final Color squareColor = new Color(250, 220, 190);
//	private static final Color squareColor = new Color(250, 220, 190);
	private static final Color squareColor = Color.WHITE;
	private static final Color chessColor = new Color(255, 251, 210);
	protected int spacingLength;

	protected static Font ALIVE_CHESS_FONT;
@@ -124,7 +126,7 @@ public class SquareCom extends JComponent {
		//更新其上的ChessCom
		if (this.getBackSquare() instanceof Chess chess) {
			//绘制棋子内容
			g.setColor(Color.ORANGE);
			g.setColor(chessColor);
			g.fillOval(this.spacingLength, this.spacingLength,
					this.getWidth() - 2 * this.spacingLength,
					this.getHeight() - 2 * this.spacingLength);
@@ -146,9 +148,9 @@ public class SquareCom extends JComponent {

				//绘制棋子被选中时状态
				if (chess.id == ChessClickController.INSTANCE.getFirstId()) {
					g.setColor(Color.RED);
					g.setColor(Color.DARK_GRAY);
					g2 = (Graphics2D) g;
					g2.setStroke(new BasicStroke(4f));
					g2.setStroke(new BasicStroke(3f));
					g2.drawOval(this.spacingLength, this.spacingLength,
							this.getWidth() - 2 * this.spacingLength,
							this.getHeight() - 2 * this.spacingLength);
+8 −8
Original line number Diff line number Diff line
@@ -21,8 +21,8 @@ import java.util.concurrent.CompletableFuture;
public class ChessGameFrame extends JFrame {

	public static ChessGameFrame instance;
	private CompletableFuture<FrameReturnType<ChessGameFrame>> future;
	private Background currentBackground = Background.BLACK;
	private final CompletableFuture<FrameReturnType<ChessGameFrame>> future;
	private Background currentBackground = Background.CHEMISTRY;
	private JLabel backgroundLabel;
	private final int WIDTH = 620;
	private final int HEIGHT = 900;
@@ -50,12 +50,12 @@ public class ChessGameFrame extends JFrame {
		setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); //设置程序关闭按键,别给全关了
		setLayout(null);

		// start playing bgm ASA game is opened
		new Thread(() -> {
			while (true) {
				bgm.playMusic(flag);
			}
		}).start();
//		// start playing bgm ASA game is opened
//		new Thread(() -> {
//			while (true) {
//				bgm.playMusic(flag);
//			}
//		}).start();

		addChessboard();
		addStatusLabel();