Skip to content

Commit e40a5a0

Browse files
committed
first commit
0 parents  commit e40a5a0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+2132
-0
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
### Example user template template
2+
### Example user template
3+
4+
# IntelliJ project files
5+
.idea
6+
*.iml
7+
out
8+
gen

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Project2 样例2
2+
3+
作者:郑文峰

animal.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
608000107
2+
020000040
3+
003000500
4+
000000000
5+
005000300
6+
040000020
7+
701000806

file.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
000000000
2+
000111000
3+
200111004
4+
320000045
5+
200111004
6+
000111000
7+
000000000

saves/save1.dat

324 KB
Binary file not shown.

saves/save2.dat

324 KB
Binary file not shown.

saves/save3.dat

324 KB
Binary file not shown.

src/Animal/Animal.java

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package Animal;
2+
3+
import Map.TileType;
4+
5+
import java.io.FileNotFoundException;
6+
7+
//继承TileType类,主要用于获取动物的数字地图及阵营
8+
public class Animal extends TileType{
9+
private int numberOfAnimal[][];
10+
private int[][] theTeam;
11+
12+
public Animal() throws FileNotFoundException {
13+
super("animal.txt");
14+
numberOfAnimal =new int[7][9];
15+
theTeam = new int[7][9];
16+
for(int i = 0; i < 7; i++){
17+
for(int j = 0; j < 9; j++){
18+
numberOfAnimal[i][j] = this.getNumber()[i][j];
19+
}
20+
}
21+
for(int i = 0; i < 7; i++){
22+
for(int j = 0; j < 9; j++){
23+
if(numberOfAnimal[i][j] != 0 && j < 4){
24+
theTeam[i][j] = 1;
25+
}else if(numberOfAnimal[i][j] != 0 && j > 4){
26+
theTeam[i][j] = -1;
27+
}else
28+
theTeam[i][j] = 0;
29+
}
30+
}
31+
}
32+
33+
34+
public int[][] getNumberOfAnimal() {
35+
return numberOfAnimal;
36+
}
37+
38+
//获取阵营
39+
public int[][] getTheTeam(){
40+
return theTeam;
41+
}
42+
43+
}

src/Animal/SoundControl.java

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package Animal;
2+
3+
import GameRule.GameHistory;
4+
import javafx.scene.media.Media;
5+
import javafx.scene.media.MediaPlayer;
6+
7+
/**
8+
* Created by admin on 2017/1/3.
9+
*/
10+
public class SoundControl {
11+
String[] soundName;
12+
Media[] sounds;
13+
Media music;
14+
MediaPlayer mediaPlayer, musicPlayer;
15+
public SoundControl(){
16+
soundName = new String[8];
17+
soundName[0] = "Mouse.mp3";
18+
soundName[1] = "Cat.mp3";
19+
soundName[2] = "Wolf.mp3";
20+
soundName[3] = "Dog.mp3";
21+
soundName[4] = "Leopard.mp3";
22+
soundName[5] = "Tiger.mp3";
23+
soundName[6] = "Lion.mp3";
24+
soundName[7] = "Elephant.mp3";
25+
sounds = new Media[soundName.length];
26+
for(int i=0;i<soundName.length;i++){
27+
sounds[i] = new Media(SoundControl.class.getResource("/" + soundName[i]).toString());
28+
}
29+
music = new Media(SoundControl.class.getResource("/bgm.mp3").toString());
30+
31+
}
32+
33+
//判断当前是否播放音效,之后进行播放
34+
public void play(int index){
35+
if(mediaPlayer != null){
36+
mediaPlayer.stop();
37+
}
38+
mediaPlayer = new MediaPlayer(sounds[index]);
39+
mediaPlayer.setCycleCount(1);
40+
mediaPlayer.play();
41+
}
42+
public void music(){
43+
musicPlayer = new MediaPlayer(music);
44+
musicPlayer.setCycleCount(MediaPlayer.INDEFINITE);
45+
musicPlayer.play();
46+
47+
}
48+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package Exception;
2+
3+
/**
4+
* Created by admin on 2016/12/21.
5+
*/
6+
public class CannotRedoException extends Exception{
7+
}

0 commit comments

Comments
 (0)