Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
IT-Bill committed Mar 17, 2023
0 parents commit 9add0b5
Show file tree
Hide file tree
Showing 173 changed files with 3,429 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions .idea/artifacts/Reversi_jar.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/libraries/activation.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/libraries/beautyeye_lnf.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/libraries/javax_mail.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions Reversi.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="activation" level="project" />
<orderEntry type="library" name="beautyeye_lnf" level="project" />
<orderEntry type="library" name="javax.mail" level="project" />
</component>
</module>
Binary file added Reversi.jar
Binary file not shown.
Binary file added images/back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/back_home.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/bg1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/bg_music.wav
Binary file not shown.
Binary file added images/black.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/black2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/board.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/cheat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/clear.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/clock.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/feedback.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/flip_img/flip-01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/flip_img/flip-02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/flip_img/flip-03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/flip_img/flip-04.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/flip_img/flip-05.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/flip_img/flip-06.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/flip_img/flip-07.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/flip_img/flip-08.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/flip_img/flip-09.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/flip_img/flip-10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/flip_img/flip-11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/flip_img/flip-12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/flip_img/flip-13.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/flip_img/flip-14.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/flip_img/flip-15.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/flip_img/flip-16.png
Binary file added images/flip_img/flip-17.png
Binary file added images/flip_img/flip-18.png
Binary file added images/flip_img/flip-19.png
Binary file added images/flip_img/flip-20.png
Binary file added images/flip_img/flip-21.png
Binary file added images/flip_img/flip-22.png
Binary file added images/flip_img/flip-23.png
Binary file added images/flip_img/flip-24.png
Binary file added images/flip_img/flip-25.png
Binary file added images/flip_img/flip-26.png
Binary file added images/flip_img/flip-27.png
Binary file added images/flip_img/flip-28.png
Binary file added images/flip_img/flip-29.png
Binary file added images/flip_img/flip-30.png
Binary file added images/game_bg.jpg
Binary file added images/home_bg.jpg
Binary file added images/home_bg2.jpeg
Binary file added images/load.png
Binary file added images/place.wav
Binary file not shown.
Binary file added images/quit.jpg
Binary file added images/quit.png
Binary file added images/restart.png
Binary file added images/robot.png
Binary file added images/rule.png
Binary file added images/rule1.jpg
Binary file added images/rule2.jpg
Binary file added images/rule3.jpg
Binary file added images/rule4.jpg
Binary file added images/save.png
Binary file added images/setting.png
Binary file added images/setting_small.png
Binary file added images/tip.png
Binary file added images/title.png
Binary file added images/two.png
Binary file added images/white.png
Binary file added images/white2.png
Binary file added lib/activation.jar
Binary file not shown.
Binary file added lib/beautyeye_lnf.jar
Binary file not shown.
Binary file added lib/javax.mail.jar
Binary file not shown.
Binary file added out/artifacts/Reversi_jar/Reversi.jar
Binary file not shown.
3 changes: 3 additions & 0 deletions out/production/Reversi/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Main-Class: Main

Binary file added out/production/Reversi/Main.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added out/production/Reversi/components/MyButton.class
Binary file not shown.
Binary file added out/production/Reversi/components/Theme.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added out/production/Reversi/controller/MinMax.class
Binary file not shown.
Binary file added out/production/Reversi/controller/SendEmail$1.class
Binary file not shown.
Binary file added out/production/Reversi/controller/SendEmail.class
Binary file not shown.
Binary file not shown.
Binary file added out/production/Reversi/gameUtil/GameUtil.class
Binary file not shown.
Binary file not shown.
Binary file added out/production/Reversi/gameUtil/Path.class
Binary file not shown.
Binary file added out/production/Reversi/model/GameStack.class
Binary file not shown.
Binary file not shown.
Binary file added out/production/Reversi/view/game/BtnPanel$1.class
Binary file not shown.
Binary file added out/production/Reversi/view/game/BtnPanel$10.class
Binary file not shown.
Binary file added out/production/Reversi/view/game/BtnPanel$2.class
Binary file not shown.
Binary file added out/production/Reversi/view/game/BtnPanel$3.class
Binary file not shown.
Binary file not shown.
Binary file added out/production/Reversi/view/game/BtnPanel$5.class
Binary file not shown.
Binary file added out/production/Reversi/view/game/BtnPanel$6.class
Binary file not shown.
Binary file added out/production/Reversi/view/game/BtnPanel$7.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added out/production/Reversi/view/game/ClockPanel.class
Binary file not shown.
Binary file added out/production/Reversi/view/game/GameFrame.class
Binary file not shown.
Binary file added out/production/Reversi/view/game/MsgPanel.class
Binary file not shown.
Binary file added out/production/Reversi/view/game/ScorePanel.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added out/production/Reversi/view/game/ToolPanel.class
Binary file not shown.
Binary file not shown.
Binary file added out/production/Reversi/view/game/VideoPanel.class
Binary file not shown.
Binary file added out/production/Reversi/view/home/BtnPanel$1.class
Binary file not shown.
Binary file added out/production/Reversi/view/home/BtnPanel$2.class
Binary file not shown.
Binary file added out/production/Reversi/view/home/BtnPanel$3.class
Binary file not shown.
Binary file added out/production/Reversi/view/home/BtnPanel.class
Binary file not shown.
Binary file added out/production/Reversi/view/home/HomeFrame.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added out/production/Reversi/view/home/SetupPanel$1.class
Binary file not shown.
Binary file not shown.
Binary file added out/production/Reversi/view/home/SetupPanel.class
Binary file not shown.
Binary file added out/production/Reversi/view/home/TitlePanel.class
Binary file not shown.
3 changes: 3 additions & 0 deletions src/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Main-Class: Main

20 changes: 20 additions & 0 deletions src/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import view.home.HomeFrame;

import javax.swing.*;

public class Main {
public static void main(String[] args) {
try {
UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");
} catch (Exception e) {
e.printStackTrace();
}

SwingUtilities.invokeLater(() -> {
HomeFrame homeFrame = new HomeFrame(1300, 730);
homeFrame.setVisible(true);

});
}

}
3 changes: 3 additions & 0 deletions src/TestClass.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@



33 changes: 33 additions & 0 deletions src/components/BasicComponent.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package components;

import javax.swing.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

public abstract class BasicComponent extends JComponent {
public BasicComponent() {
this.addMouseListener(new MouseAdapter() {
@Override
public void mouseReleased(MouseEvent e) {
onMouseReleased(e);
}

@Override
public void mouseMoved(MouseEvent e) {
onMouseMoved();
}
});
}

/**
* @author Bill
* @description 重写此方法,点击时调用
**/
public abstract void onMouseReleased(MouseEvent e);

/**
* @author Bill
* @description 重写此方法,鼠标移动时调用
**/
public abstract void onMouseMoved();
}
182 changes: 182 additions & 0 deletions src/components/ChessGridComponent.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
package components;

import controller.BoardController;
import model.GameStack;
import view.game.GameFrame;
import view.game.VideoPanel;

import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.lang.reflect.InvocationTargetException;

/**
* @author Bill
* @description 每个棋格 棋格组件类
**/
public class ChessGridComponent extends BasicComponent {
public static int chessSize; //棋子的直径
public static final int gridSize = 79; //棋格的边长
private static final Color LIGHT_COLOR = new Color(144, 186, 200); //棋格的颜色
private static final Color DARK_COLOR = new Color(82, 138, 158); //棋格的颜色
private final Color color;
private ChessPiece oldPiece;
private ChessPiece chessPiece;
private VideoPanel videoPanel = new VideoPanel();

private int row; //行 y
private int col; //列 x

private boolean justNow; //是否是刚刚下的子

public ChessGridComponent(int col, int row) {
this.setSize(gridSize + 2, gridSize + 2); //设置棋格的边长
this.row = row; //鼠标所在的行
this.col = col; //鼠标所在的列
//格子的颜色深浅不同
if ((row + col) % 2 == 0) {
color = LIGHT_COLOR;
} else {
color = DARK_COLOR;
}
oldPiece = chessPiece;
// videoPanel = new VideoPanel();
// videoPanel.setVisible(true);


}

public ChessPiece getChessPiece() {
return chessPiece;
}


public void setChessPiece(ChessPiece chessPiece) {
this.chessPiece = chessPiece;
}

public void setOldPiece(ChessPiece oldPiece) {
this.oldPiece = oldPiece;
}

public int getRow() {
return row;
}

public int getCol() {
return col;
}

/**
* @author Bill
* @description 画每个格子的颜色(如果有棋子也画)
**/
public void drawPiece(Graphics g) {
if (GameFrame.controller.getTheme() == Theme.BLUE) {
g.setColor(color);
//是fill,不是draw!!
g.fill3DRect(4, 4, gridSize, gridSize, true);
} else if (GameFrame.controller.getTheme() == Theme.ELEGANT) {
Graphics2D g1 = (Graphics2D) g;
g1.setStroke(new BasicStroke(2));
// g1.setColor();
g1.drawRect(2, 2, gridSize, gridSize);
} else if (GameFrame.controller.getTheme() == Theme.CLASSIC) {

}

//标记可以下的点
//半透明圆圈
GameFrame.controller.setBoardController();
BoardController b = GameFrame.controller.getBoardController();
g.setColor(Color.GREEN);
if (b.isLegalPlace(true, row, col)) {
if (GameFrame.controller.getCurrentPlayer() == ChessPiece.BLACK) {
g.drawImage(Transparent.BLACK.getImage(), 20, 20, null);
} else {
g.drawImage(Transparent.WHITE.getImage(), 20, 20, null);
}

}


if (oldPiece != chessPiece && !justNow && GameFrame.controller.isVideoOn()) {

g.setColor(color);
//是fill,不是draw!!
g.fill3DRect(4, 4, gridSize, gridSize, true);


boolean b1 = true;
if (oldPiece == ChessPiece.BLACK && chessPiece == ChessPiece.WHITE) {
b1 = false;
} else if (oldPiece == ChessPiece.WHITE && chessPiece == ChessPiece.BLACK) {
b1 = true;
}


videoPanel = new VideoPanel();
// System.out.print(Thread.currentThread());
videoPanel.setLocation(6, 7);
add(videoPanel);
videoPanel.setVisible(true);
boolean finalB = b1;

Runnable r1 = new Thread(() -> videoPanel.playVideo(chessPiece, finalB));

SwingUtilities.invokeLater(r1);


// try {
// Thread.sleep(700);
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
// g.drawImage(chessPiece.getImage(), 7, 7, null);


} else if (chessPiece != null) {
g.drawImage(chessPiece.getImage(), 7, 7, null);
}

oldPiece = chessPiece;

if (justNow) {
g.setColor(Color.RED);
g.fillOval(38, 38, 10, 10);
}
}

@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
drawPiece(g);
}

@Override
public void onMouseReleased(MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON1 &&
!(GameFrame.controller.isMachineMode() &&
GameFrame.controller.getCurrentPlayer() != GameFrame.controller.getManPiece())) { //鼠标左键按下
System.out.printf("%s clicked (%d, %d)\n", GameFrame.controller.getCurrentPlayer(), row, col);
GameFrame.controller.click(row, col);
}


// HomeFrame.gameFrame.repaint();
}

@Override
public void onMouseMoved() {
// repaint();
System.out.println("fhasdjhfkladjfklaj;fa");
}

public boolean isJustNow() {
return justNow;
}

public void setJustNow(boolean justNow) {
this.justNow = justNow;
}
}
43 changes: 43 additions & 0 deletions src/components/ChessPiece.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package components;

import gameUtil.Path;

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

/**
* @author Bill
* @description 单个棋子组件
**/
public enum ChessPiece {
BLACK(Path.BLACK_PIECE, -1, "黑方"),
WHITE(Path.WHITE_PIECE, 1, "白方");

private BufferedImage image;
private int color;
private String name;

ChessPiece(String filePath, int color, String name) {
try {
image = ImageIO.read(new File(filePath));
} catch (IOException e) {
e.printStackTrace();
}
this.color = color;
this.name = name;
}

public BufferedImage getImage() {
return image;
}

public int getColor() {
return color;
}

public String getName() {
return name;
}
}
Loading

0 comments on commit 9add0b5

Please sign in to comment.