Xiao 2 years ago
parent 5226744363
commit 3cb0e9180e

@ -24,6 +24,12 @@ public class BrandUtil {
"羊9","羊10","羊11","羊12", "羊9","羊10","羊11","羊12",
"羊13","羊14","羊15","羊16", "羊13","羊14","羊15","羊16",
}; };
public static String[] brandName3={
"羊狼1","羊狼2","羊狼3","羊狼4",
"羊狼5","羊狼6","羊狼7","羊狼8",
"羊狼9","羊狼10","羊狼11","羊狼12",
"羊狼13","羊狼14","羊狼15","羊狼16",
};
public static String getBrandName(Integer gameMode){ public static String getBrandName(Integer gameMode){
int randomIndex = random.nextInt(brandName1.length); int randomIndex = random.nextInt(brandName1.length);
String retname = ""; String retname = "";
@ -34,6 +40,9 @@ public class BrandUtil {
case 2: case 2:
retname = brandName2[randomIndex]; retname = brandName2[randomIndex];
break; break;
case 3:
retname = brandName3[randomIndex];
break;
} }
return retname; return retname;
} }

@ -29,7 +29,7 @@ public class Game extends JFrame {
MapUtil.compareAll(map); MapUtil.compareAll(map);
//添加背景 //添加背景
addBackgound(); addBackgound(gameMode);
aotoRefresh();//自动刷新 aotoRefresh();//自动刷新
} }
@ -63,10 +63,25 @@ public class Game extends JFrame {
} }
} }
private void addBackgound(){ private void addBackgound(int gameMode){
JLabel backgroungLabel = new JLabel(new ImageIcon("imgs/背景1.png")); JLabel backgroungLabel;
switch(gameMode){
case 1:
backgroungLabel = new JLabel(new ImageIcon("imgs/背景1_1.png"));
backgroungLabel.setBounds(0,0,450,800); backgroungLabel.setBounds(0,0,450,800);
this.add(backgroungLabel); this.add(backgroungLabel);
break;
case 2:
backgroungLabel = new JLabel(new ImageIcon("imgs/背景2_1.png"));
backgroungLabel.setBounds(0,0,450,800);
this.add(backgroungLabel);
break;
case 3:
backgroungLabel = new JLabel(new ImageIcon("imgs/背景3_1.png"));
backgroungLabel.setBounds(0,0,450,800);
this.add(backgroungLabel);
break;
}
} }
private void aotoRefresh(){ private void aotoRefresh(){

@ -50,7 +50,7 @@ public class Start extends JFrame {
gameMode2.setBounds(200,550,50,50); gameMode2.setBounds(200,550,50,50);
this.add(gameMode2); this.add(gameMode2);
JLabel gameMode3 = new JLabel(new ImageIcon("imgs/羊1.png")); JLabel gameMode3 = new JLabel(new ImageIcon("imgs/羊1.png"));
gameMode3.setBounds(300,550,50,50); gameMode3.setBounds(300,550,50,50);
this.add(gameMode3); this.add(gameMode3);
@ -88,7 +88,7 @@ public class Start extends JFrame {
gameMode3.addMouseListener(new MouseAdapter() { gameMode3.addMouseListener(new MouseAdapter() {
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
gameMode = 2; gameMode = 3;
backgroundLabel.setIcon(new ImageIcon("imgs/背景3.png")); backgroundLabel.setIcon(new ImageIcon("imgs/背景3.png"));
backgroundLabel.repaint(); backgroundLabel.repaint();

Loading…
Cancel
Save