究竟怎样的嘉宾上场音乐顺序有利于选手pcs

项目语言:JAVA
权限:read-only(如需更高权限请先加入项目)
Index: screen/GameScreen_old.java
===================================================================
--- screen/GameScreen_old.java (revision 0)
+++ screen/GameScreen_old.java (revision 6)
@@ -0,0 +1,570 @@
+package com.china1169.impulsecontrol.
+import java.text.NumberF
+import java.text.SimpleDateF
+import java.util.ArrayL
+import java.util.D
+import java.util.LinkedHashM
+import java.util.L
+import java.util.M
+import java.util.R
+import java.util.T
+import java.util.TimerT
+import com.badlogic.gdx.scenes.scene2d.A
+import com.badlogic.gdx.scenes.scene2d.S
+import com.badlogic.gdx.scenes.scene2d.ui.I
+import com.badlogic.gdx.scenes.scene2d.ui.ImageB
+import com.badlogic.gdx.scenes.scene2d.utils.ChangeL
+import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionD
+import com.china1169.impulsecontrol.assets.A
+import com.china1169.impulsecontrol.assets.MyD
+import com.china1169.impulsecontrol.assets.MyP
+import com.china1169.impulsecontrol.assets.PreP
+import com.sky.demon.game.screens.AbstractGameS
+import com.sky.demon.game.screens.DirectedG
+import com.sky.demon.game.utils.UiU
+ * @author ldd 游戏界面
+public class GameScreen_old extends AbstractGameScreen {
+ private Image backG// 背景图片
+ private PreP
+ private MyP
+ private ImageButton kbB// 空白点击按钮
+ private ImageButton dgB// 打勾
+ private ImageButton dxB// 打叉
+ private Image questionN// 题目数字
+ private boolean gotoNextScreen =
+ public GameState gameS
+ private TimerTask taskDownG
+ public S
+ private int currentLevel = 1;// 首次等级为1
+ private int questionNums = 10;// 题目数量
+ private double qiProportion = 0.5;// 数字七出现的比例
+ private int showTime = 1500;// 刺激显示时间
+ private int[] numS// 数字顺序
+ private Random rand = new Random();
+ private int playInt = 0;// 第几题
+ private String rightNum = &&;// 正确答案
+ private String answerNum = &&;// 回答的答案
+ private int answerRightCount = 0;// 答对题数
+ private Map&String, List&Object&& resultM
+ public GameScreen_old(DirectedGame game,int currentLevel) {
super(game);
this.mestage =
this.currentLevel = currentL
+ private T
+ @Override
+ public void show() {
stage.addActor(backGround);
stage.addActor(kbBut);
stage.addActor(questionNum);
// 设置位置
this.setPosition();
// 添加按钮监听
this.buttonAddListener();
+ boolean isStop =
+ boolean isGOing =
+ private void start() {
if (isGOing) {
if (timer == null) {
timer = new Timer();
if (taskDownGame == null) {
taskDownGame = new TimerTask() {
public void run() {
if (playInt & questionNums) {
playInt++;
if (answerNum.equals(&&)) {
answerNum = &3&;
questionPlay();
NumberFormat numberFormat = NumberFormat.getInstance();
numberFormat.setMaximumFractionDigits(2);
String result = numberFormat
.format((float) answerRightCount
/ (float) questionNums * 100);
System.out.println(&正确率:& + result + &%&);
if (resultMap == null) {
resultMap = new LinkedHashMap&String, List&Object&&();
String aveTime = numberFormat
.format((float) allAnswerTime
/ (float) answerCount / 1000);// df.format((allAnswerTime/answerCount/1000*10));
SimpleDateFormat d = new SimpleDateFormat(
&yyyy-MM-dd HH:mm:ss.SSS&);// 格式化时间
String endTime = d.format(new Date());// 按以上格式
// 将当前时间转换成字符串
double levelAllTime = 0;
long temp = (d.parse(endTime).getTime() - d.parse(
startTime).getTime());
levelAllTime = Double.parseDouble(numberFormat
.format((float) temp / 1000 / 60));
} catch (java.text.ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
List&Object& resultList = new ArrayList&Object&();
resultList.add(levelAllTime);
resultList.add(aveTime);
resultList.add(result);
resultMap.put(String.valueOf(currentLevel), resultList);
if (result.equals(&100&)) {
if (currentLevel == 15) {
showCompleteAlert();
showNextLevelAlert();
showPalyAgainAlert();
SimpleDateFormat d = new SimpleDateFormat(
&yyyy-MM-dd HH:mm:ss.SSS&);// 格式化时间
questionShowTime = d.format(new Date());// 按以上格式 将当前时间转换成字符串
if (timer != null && taskDownGame != null) {
timer.schedule(taskDownGame, showTime, showTime);
+ private void stop() {
if (timer != null) {
timer.cancel();
if (taskDownGame != null) {
taskDownGame.cancel();
taskDownGame =
+ private void restart() {
if (timer != null) {
timer.cancel();
if (taskDownGame != null) {
taskDownGame.cancel();
taskDownGame =
+ public void init() {
getParam();
assetspic = Assets.instance.preA
point = Assets.instance.
// /创建演员
backGround = new Image(assetspic.imageBg);
backGround.setFillParent(true);// 设置为全屏显示
kbBut = new ImageButton(new TextureRegionDrawable(
assetspic.confirmButUp), new TextureRegionDrawable(
assetspic.confirmButDown));
dgBut = new ImageButton(new TextureRegionDrawable(assetspic.rightPic));
dxBut = new ImageButton(new TextureRegionDrawable(assetspic.wrongPic));
questionPlay();
* 切换题目
+ private int isShowQuestionNums = 0;
+ private String startT// 等级开始时间
+ public void questionPlay() {
isAnswer =
if (isShowQuestionNums == 0) {
SimpleDateFormat d = new SimpleDateFormat(&yyyy-MM-dd HH:mm:ss.SSS&);// 格式化时间
startTime = d.format(new Date());// 按以上格式 将当前时间转换成字符串
if (questionShowTime == null) {
SimpleDateFormat d = new SimpleDateFormat(&yyyy-MM-dd HH:mm:ss.SSS&);// 格式化时间
questionShowTime = d.format(new Date());// 按以上格式 将当前时间转换成字符串
removeDxdg();
System.err.println(&答:& + answerNum + &==正确:& + rightNum);
if (!answerNum.equals(&&)) {
if (answerNum.equals(rightNum)) {
Assets.instance.gameObjectsAssets.rightSoundPlay();
stage.addActor(dgBut);
answerRightCount++;
Assets.instance.gameObjectsAssets.errorSoundPlay();
stage.addActor(dxBut);
if (isShowQuestionNums &= questionNums) {
if (kbBut != null) {
kbBut.remove();
Thread.sleep(1000);
stage.addActor(kbBut);
restart();
removeDxdg();
} catch (InterruptedException e) {
e.printStackTrace();
String show = String.valueOf(numSequence[isShowQuestionNums]);
rightNum =
if (questionNum != null) {
questionNum.remove();
if (show.equals(&7&)) {
questionNum = new Image(assetspic.xjjImage);
questionNum = new Image(assetspic.shouImage);
stage.addActor(questionNum);
this.setPosition();
isShowQuestionNums++;
answerNum = &&;
+ private String questionShowT// 题目出现时间
+ private String butClickT// 按钮按下时间
+ private boolean isAnswer =
+ private double allAnswerTime = 0;// 所有有按键的时间
+ private int answerCount = 0;// 按键次数
+ private void buttonAddListener() {
kbBut.addListener(new ChangeListener() {
public void changed(ChangeEvent event, Actor actor) {
answerCount++;
if (isAnswer == true) {
isAnswer =
SimpleDateFormat d = new SimpleDateFormat(
&yyyy-MM-dd HH:mm:ss.SSS&);// 格式化时间
butClickTime = d.format(new Date());// 按以上格式 将当前时间转换成字符串
long result = 0;
result = (d.parse(butClickTime).getTime() - d.parse(
questionShowTime).getTime());
} catch (java.text.ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
allAnswerTime +=
System.out.println(&当前时间减去测试时间=& + result + &毫秒&);
answerNum = &7&;
* 清除对错按钮
+ private void removeDxdg() {
if (dgBut != null) {
dgBut.remove();
if (dxBut != null) {
dxBut.remove();
+ public void gotoNextLevel() {
clearParam();
getParam();
removeDxdg();
restart();
+ public void showCompleteAlert() {
MyDialog.showCompleteAlert(stage, mBgBeginPoint.x, mBgBeginPoint.y,
new ChangeListener() {
public void changed(ChangeEvent event, Actor actor) {
palyAgainCurrentLevel();
}, new ChangeListener() {
public void changed(ChangeEvent event, Actor actor) {
UiUtils.gotoScreen(game, new ResultScreen2(game,
resultMap));
+ public void showNextLevelAlert() {
MyDialog.showNextLevelAlert(stage, mBgBeginPoint.x, mBgBeginPoint.y,
new ChangeListener() {
public void changed(ChangeEvent event, Actor actor) {
currentLevel++;
SimpleDateFormat d = new SimpleDateFormat(
&yyyy-MM-dd HH:mm:ss.SSS&);// 格式化时间
questionShowTime = d.format(new Date());// 按以上格式
// 将当前时间转换成字符串
gotoNextLevel();
}, new ChangeListener() {
public void changed(ChangeEvent event, Actor actor) {
UiUtils.gotoScreen(game, new ResultScreen2(game,
resultMap));
+ public void showPalyAgainAlert() {
MyDialog.showPalyAgainAlert(stage, mBgBeginPoint.x, mBgBeginPoint.y,
new ChangeListener() {
public void changed(ChangeEvent event, Actor actor) {
SimpleDateFormat d = new SimpleDateFormat(
&yyyy-MM-dd HH:mm:ss.SSS&);// 格式化时间
questionShowTime = d.format(new Date());// 按以上格式
// 将当前时间转换成字符串
palyAgainCurrentLevel();
}, new ChangeListener() {
public void changed(ChangeEvent event, Actor actor) {
UiUtils.gotoScreen(game, new ResultScreen2(game,
resultMap));
* 重玩游戏
+ public void palyAgainCurrentLevel() {
clearParam();
getParam();
removeDxdg();
restart();
* 回归参数
+ public void clearParam() {
numSequence =
// Arrays.fill(numSequence, -1);
playInt = 0;
isShowQuestionNums = 0;
isAnswer =
answerRightCount = 0;
answerNum = &&;
* 获取参数
+ public void getParam() {
if (currentLevel == 1) {
questionNums = 8;
qiProportion = 0.75;
showTime = 1500;
} else if (currentLevel == 2) {
questionNums = 60;
qiProportion = 0.8;
showTime = 1500;
} else if (currentLevel == 3) {
questionNums = 60;
qiProportion = 0.85;
showTime = 1500;
} else if (currentLevel == 4) {
questionNums = 60;
qiProportion = 0.9;
showTime = 1500;
} else if (currentLevel == 5) {
questionNums = 60;
qiProportion = 0.75;
showTime = 1000;
} else if (currentLevel == 6) {
questionNums = 30;
qiProportion = 0.8;
showTime = 1000;
} else if (currentLevel == 7) {
questionNums = 60;
qiProportion = 0.85;
showTime = 10000;
} else if (currentLevel == 8) {
questionNums = 60;
qiProportion = 0.9;
showTime = 1000;
} else if (currentLevel == 9) {
questionNums = 60;
qiProportion = 0.75;
showTime = 800;
} else if (currentLevel == 10) {
questionNums = 60;
qiProportion = 0.8;
showTime = 800;
} else if (currentLevel == 11) {
questionNums = 60;
qiProportion = 0.5;
showTime = 800;
} else if (currentLevel == 12) {
questionNums = 60;
qiProportion = 0.9;
showTime = 800;
} else if (currentLevel == 13) {
questionNums = 60;
qiProportion = 0.75;
showTime = 500;
} else if (currentLevel == 14) {
questionNums = 60;
qiProportion = 0.8;
showTime = 500;
} else if (currentLevel == 15) {
questionNums = 60;
qiProportion = 0.85;
showTime = 500;
} else if (currentLevel == 16) {
questionNums = 60;
qiProportion = 0.9;
showTime = 500;
// 计算出现图片的规律
for (int i = 0; i & questionN i++) {
if (numSequence == null) {
numSequence = new int[questionNums];
int qiTempCount = 0;
int sanTempCount = 0;
for (int j = 0; j & numSequence. j++) {
if (numSequence[j] == 7) {
qiTempCount++;
} else if (numSequence[j] == 3) {
sanTempCount++;
if (qiTempCount &= questionNums * qiProportion) {
numSequence[i] = 3;
} else if (sanTempCount &= questionNums
- (questionNums * qiProportion)) {
numSequence[i] = 7;
int temp = rand.nextInt(2);
if (temp == 0) {
numSequence[i] = 7;
numSequence[i] = 3;
for (int i = 0; i & numSequence. i++) {
System.err.println(numSequence[i]);
* 位置拜放
+ private void setPosition() {
if (questionNum != null) {
questionNum.setPosition(point.w / 2 - questionNum.getWidth() / 2,
point.h / 2 - questionNum.getHeight() / 2 + 70);
if (kbBut != null) {
kbBut.setPosition(point.w / 2 - kbBut.getWidth() / 2, 70);
dgBut.setPosition(point.w / 2 - dgBut.getWidth() / 2, point.h / 2
- dgBut.getHeight() / 2 + 70);
dxBut.setPosition(point.w / 2 - dxBut.getWidth() / 2, point.h / 2
- dxBut.getHeight() / 2 + 70);
+ @Override
+ public void hide() {
+ @Override
+ public void pause() {
+ public enum GameState {
* 游戏进行中
* 游戏结束
+ @Override
+ public void resize(int width, int height) {
super.resize(width, height);
backGround.setScale(mBgScale);
backGround.setPosition(mBgBeginPoint.x, mBgBeginPoint.y);
+ @Override
+ public void resume() {
super.resume();
+ @Override
+ public void render(float deltaTime) {
super.render(deltaTime);
if (gotoNextScreen) {
// UiUtils.gotoScreen(game, new OverGame(game, userInfo));
+ @Override
+ public void dispose() {
super.dispose();
Index: screen/HelpScreen.java
===================================================================
--- screen/HelpScreen.java (revision 0)
+++ screen/HelpScreen.java (revision 6)
@@ -0,0 +1,457 @@
+package com.china1169.impulsecontrol.
+import com.badlogic.gdx.graphics.C
+import com.badlogic.gdx.graphics.g2d.S
+import com.badlogic.gdx.scenes.scene2d.A
+import com.badlogic.gdx.scenes.scene2d.InputE
+import com.badlogic.gdx.scenes.scene2d.S
+import com.badlogic.gdx.scenes.scene2d.ui.I
+import com.badlogic.gdx.scenes.scene2d.ui.ImageB
+import com.badlogic.gdx.scenes.scene2d.ui.L
+import com.badlogic.gdx.scenes.scene2d.ui.Label.LabelS
+import com.badlogic.gdx.scenes.scene2d.utils.A
+import com.badlogic.gdx.scenes.scene2d.utils.ChangeL
+import com.badlogic.gdx.scenes.scene2d.utils.ClickL
+import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionD
+import com.china1169.impulsecontrol.assets.A
+import com.china1169.impulsecontrol.assets.MyP
+import com.china1169.impulsecontrol.assets.PreP
+import com.china1169.impulsecontrol.widget.ButtonV
+import com.sky.demon.game.screens.AbstractGameS
+import com.sky.demon.game.screens.DirectedG
+import com.sky.demon.game.utils.UiU
+ * 游戏介绍界面
+ * @author ldd
+public class HelpScreen extends AbstractGameScreen {
+ public S
+ private Image backG//背景图片
+ private PreP
+ private MyP
+ private Label gameD//游戏描述
+ private ImageButton nextStepB//下一步按钮
+ private ImageButton kbB// 空白点击按钮
+ private ImageButton kbButT// 空白点击按钮
+ private Image dgB// 打勾
+ private Image dxB// 打勾
+ private Label answeR//操作正确提示
+ private Label answeW//操作正确提示
+ private int steps=1;//步骤
+ private Image hongD//questionNum = new Image(assetspic.xjjImage);
+ private Image lvD
+ private ButtonView startGameB// 开始游戏按钮
+ private ButtonView againL// 重新玩一次
+ private int currentL
+ public HelpScreen(DirectedGame game,int currentLevel) {
super(game);
this.mestage=
assetspic=Assets.instance.preA
point=Assets.instance.
this.currentLevel = currentL
+ @Override
+ public void show() {
//添加背景
backGround=new Image(assetspic.imageBg);
backGround.setFillParent(true);//设置为全屏显示
stage.addActor(backGround);
//游戏描述
String introduceStr = &请注意,屏幕上将出现绿灯或红灯&;
LabelStyle labelStyle = new LabelStyle(Assets.instance.fonts.defaultBig, new Color(0f, 0f, 0f, 1f));
gameDescribe = new Label(introduceStr, labelStyle);
gameDescribe.setAlignment(Align.left);
stage.addActor(gameDescribe);
gameDescribe.setPosition(point.w / 2 - gameDescribe.getWidth() / 2, point.h-100);
Image vlBlackLine =new Image(assetspic.vBlackLine);//左边竖线
vlBlackLine.setAlign(Align.center);
vlBlackLine.setHeight(point.h*3/4);
vlBlackLine.setPosition(0, point.h/8);
stage.addActor(vlBlackLine);
Image vrBlackLine =new Image(assetspic.vBlackLine);//右边竖线
vrBlackLine.setAlign(Align.center);
vrBlackLine.setHeight(point.h*3/4);
vrBlackLine.setPosition(point.w, point.h/8);
stage.addActor(vrBlackLine);
Sprite hSprite = new Sprite(assetspic.vBlackLine);
hSprite.setRotation(180);
Image htBlackLine =new Image(hSprite);//上横线
htBlackLine.setWidth(point.w);
htBlackLine.setHeight(5);
htBlackLine.setPosition(0, point.h*7/8);
stage.addActor(htBlackLine);
Image hbBlackLine =new Image(hSprite);//下横线
hbBlackLine.setWidth(point.w);
hbBlackLine.setHeight(5);
hbBlackLine.setPosition(0, point.h/8);
stage.addActor(hbBlackLine);
nextStepBut = new ImageButton(new TextureRegionDrawable(assetspic.nextStepButUp), new TextureRegionDrawable(assetspic.nextStepButDown));
stage.addActor(nextStepBut);
nextStepBut.setPosition(point.w / 2 - nextStepBut.getWidth()/ 2, 30);
startGameBut = new ButtonView(&开始训练&);
againLook = new ButtonView(&再看一次&);
kbBut = new ImageButton(new TextureRegionDrawable(
assetspic.kbButUp), new TextureRegionDrawable(
assetspic.kbButDown));
kbButTwo = new ImageButton(new TextureRegionDrawable(
assetspic.kbButUp), new TextureRegionDrawable(
assetspic.kbButDown));
dgBut = new Image(new TextureRegionDrawable(assetspic.rightPic));
dgBut.setSize(250, 250);
dgBut.setPosition(point.w / 2 - dgBut.getWidth()/2 , point.h/2-dgBut.getHeight()/2+80);
dxBut = new Image(new TextureRegionDrawable(assetspic.wrongPic));
dxBut.setSize(250, 250);
dxBut.setPosition(point.w / 2 - dxBut.getWidth()/2 , point.h/2-dxBut.getHeight()/2+80);
//添加按钮事件
this.buttonAddListener();
//操作结果提示信息
hongDeng = new Image(assetspic.shouImage);
lvDeng = new Image(assetspic.xjjImage);
hongDeng.setPosition(point.w / 2 - hongDeng.getWidth()/2 - hongDeng.getWidth(), point.h/2-hongDeng.getHeight()/2);
lvDeng.setPosition(point.w / 2 - lvDeng.getWidth()/2 + lvDeng.getWidth(), point.h/2-lvDeng.getHeight()/2);
stage.addActor(hongDeng);
stage.addActor(lvDeng);
+ public void init(){
+ private ClickListener startGameButClickListener = new ClickListener() {
public void clicked(InputEvent event, float x, float y) {
UiUtils.gotoScreen(game, new GameScreen(game,currentLevel));
+ private ClickListener againLookClickListener = new ClickListener() {
public void clicked(InputEvent event, float x, float y) {
UiUtils.gotoScreen(game, new HelpScreen(game,currentLevel));
+ private void buttonAddListener() {
nextStepBut.addListener(new ChangeListener() {
public void changed(ChangeEvent event, Actor actor) {
if(steps==2){
showLvDeng();
}else if(steps==3){
showHongDeng();
}else if(steps==4){
showStartPane();
startGameBut.addListener(startGameButClickListener);
againLook.addListener(againLookClickListener);
kbBut.addListener(new ChangeListener() {
public void changed(ChangeEvent event, Actor actor) {
System.err.println(&123&);
stage.addActor(dgBut);
stage.addActor(answeRight);
startTimes=
kbButTwo.addListener(new ChangeListener() {
public void changed(ChangeEvent event, Actor actor) {
System.err.println(&==============&);
stage.addActor(dxBut);
stage.addActor(answeWrong);
startTimes3=
+ private void showLvDeng(){
stage.clear();
//添加背景
stage.addActor(backGround);
stage.addActor(nextStepBut);
gameDescribe.setStyle(new LabelStyle(Assets.instance.fonts.defaultBig, Color.BLACK));
gameDescribe.setText(&当出现绿灯时,您需要按键。&);
gameDescribe.setPosition(point.w / 2 - gameDescribe.getWidth() / 2, point.h-100);
gameDescribe.setAlignment(Align.center);
stage.addActor(gameDescribe);
Image vlBlackLine =new Image(assetspic.vBlackLine);//左边竖线
vlBlackLine.setAlign(Align.center);
vlBlackLine.setHeight(point.h*3/4);
vlBlackLine.setPosition(0, point.h/8);
stage.addActor(vlBlackLine);
Image vrBlackLine =new Image(assetspic.vBlackLine);//右边竖线
vrBlackLine.setAlign(Align.center);
vrBlackLine.setHeight(point.h*3/4);
vrBlackLine.setPosition(point.w, point.h/8);
stage.addActor(vrBlackLine);
Sprite hSprite = new Sprite(assetspic.vBlackLine);
hSprite.setRotation(180);
Image htBlackLine =new Image(hSprite);//上横线
htBlackLine.setWidth(point.w);
htBlackLine.setHeight(5);
htBlackLine.setPosition(0, point.h*7/8);
stage.addActor(htBlackLine);
Image hbBlackLine =new Image(hSprite);//下横线
hbBlackLine.setWidth(point.w);
hbBlackLine.setHeight(5);
hbBlackLine.setPosition(0, point.h/8);
stage.addActor(hbBlackLine);
lvDeng = new Image(assetspic.xjjImage);
lvDeng.setPosition(point.w / 2 - lvDeng.getWidth()/2 , point.h/2-lvDeng.getHeight()/2+80);
stage.addActor(lvDeng);
stage.addActor(kbBut);
kbBut.setPosition(point.w / 2 - kbBut.getWidth()/ 2, 180);
String rightPlay = &恭喜您,操作正确。&;
LabelStyle labelStyle = new LabelStyle(Assets.instance.fonts.defaultBig, new Color(0f, 0f, 0f, 1f));
answeRight = new Label(rightPlay, labelStyle);
answeRight.setPosition(point.w / 2 - answeRight.getWidth() / 2, point.h/4+50);
answeRight.setAlignment(Align.center);
+ private void showHongDeng(){
startTimes2=
stage.clear();
//添加背景
stage.addActor(backGround);
stage.addActor(nextStepBut);
if(kbBut!=null){
kbBut.remove();
stage.addActor(kbButTwo);
kbButTwo.setPosition(point.w / 2 - kbButTwo.getWidth()/ 2, 180);
gameDescribe.setStyle(new LabelStyle(Assets.instance.fonts.defaultBig, Color.BLACK));
gameDescribe.setText(&出现红灯时不要按键。&);
gameDescribe.setPosition(point.w / 2 - gameDescribe.getWidth() / 2, point.h-100);
gameDescribe.setAlignment(Align.center);
stage.addActor(gameDescribe);
Image vlBlackLine =new Image(assetspic.vBlackLine);//左边竖线
vlBlackLine.setAlign(Align.center);
vlBlackLine.setHeight(point.h*3/4);
vlBlackLine.setPosition(0, point.h/8);
stage.addActor(vlBlackLine);
Image vrBlackLine =new Image(assetspic.vBlackLine);//右边竖线
vrBlackLine.setAlign(Align.center);
vrBlackLine.setHeight(point.h*3/4);
vrBlackLine.setPosition(point.w, point.h/8);
stage.addActor(vrBlackLine);
Sprite hSprite = new Sprite(assetspic.vBlackLine);
hSprite.setRotation(180);
Image htBlackLine =new Image(hSprite);//上横线
htBlackLine.setWidth(point.w);
htBlackLine.setHeight(5);
htBlackLine.setPosition(0, point.h*7/8);
stage.addActor(htBlackLine);
Image hbBlackLine =new Image(hSprite);//下横线
hbBlackLine.setWidth(point.w);
hbBlackLine.setHeight(5);
hbBlackLine.setPosition(0, point.h/8);
stage.addActor(hbBlackLine);
hongDeng = new Image(assetspic.shouImage);
hongDeng.setPosition(point.w / 2 - hongDeng.getWidth()/2 , point.h/2-hongDeng.getHeight()/2+80);
stage.addActor(hongDeng);
String rightPlay = &对不起,出现红灯不能按按钮&;
LabelStyle labelStyle = new LabelStyle(Assets.instance.fonts.defaultBig, new Color(0f, 0f, 0f, 1f));
answeWrong = new Label(rightPlay, labelStyle);
answeWrong.setPosition(point.w / 2 - answeWrong.getWidth() / 2, point.h/4+30);
answeWrong.setAlignment(Align.center);
+ private void hongDengRight(){
String rightPlay = &恭喜您,操作正确。&;
LabelStyle labelStyle = new LabelStyle(Assets.instance.fonts.defaultBig, new Color(0f, 0f, 0f, 1f));
answeRight = new Label(rightPlay, labelStyle);
answeRight.setPosition(point.w / 2 - answeRight.getWidth() / 2, point.h/4+50);
answeRight.setAlignment(Align.center);
stage.addActor(dgBut);
stage.addActor(answeRight);
* 显示游戏开始界面
+ public void showStartPane(){
stage.clear();
//添加背景
stage.addActor(backGround);
gameDescribe.setStyle(new LabelStyle(Assets.instance.fonts.defaultBig, Color.BLACK));
gameDescribe.setText(&您需要尽可能快的反应,完成的时间越快,您的成绩越高。\n\n好,您是否已经明白该训练的操作方式?&);
gameDescribe.setPosition(point.w / 2 - gameDescribe.getWidth() / 2, point.h/2);
gameDescribe.setAlignment(Align.center);
stage.addActor(gameDescribe);
stage.addActor(startGameBut);
startGameBut.setPosition(point.w / 2 - startGameBut.getWidth()/ 2 - startGameBut.getWidth(), point.h/4);
stage.addActor(againLook);
againLook.setPosition(point.w / 2 - againLook.getWidth()/ 2 + againLook.getWidth(), point.h/4);
+ @Override
+ public void hide() {
+ @Override
+ public void pause() {
+ @Override
+ public void resize(int width, int height) {
super.resize(width, height);
backGround.setScale(mBgScale);
backGround.setPosition(mBgBeginPoint.x, mBgBeginPoint.y);
+ @Override
+ public void resume() {
super.resume();
+ private boolean startTimes=
+ private float times2;
+ private boolean startTimes2=
+ private float times3;
+ private float times4;
+ private boolean startTimes3=
+ @Override
+ public void render(float deltaTime) {
super.render(deltaTime);
if(startTimes){
times+=deltaT
if(times&=1){
showHongDeng();
startTimes=
if(startTimes3){
times3+=deltaT
if(times3&=1){
showHongDeng();
startTimes3=
if(startTimes2){
times2+=deltaT
times4+=deltaT
if(times2&=3){
hongDengRight();
if(times4&=4.5){
showStartPane();
startTimes2=
+ @Override
+ public void dispose() {
super.dispose();
Index: screen/PrepareGame.java
===================================================================
--- screen/PrepareGame.java (revision 0)
+++ screen/PrepareGame.java (revision 6)
@@ -0,0 +1,128 @@
+package com.china1169.impulsecontrol.
+import com.badlogic.gdx.G
+import com.badlogic.gdx.graphics.C
+import com.badlogic.gdx.scenes.scene2d.A
+import com.badlogic.gdx.scenes.scene2d.InputE
+import com.badlogic.gdx.scenes.scene2d.ui.I
+import com.badlogic.gdx.scenes.scene2d.ui.ImageB
+import com.badlogic.gdx.scenes.scene2d.ui.L
+import com.badlogic.gdx.scenes.scene2d.ui.Label.LabelS
+import com.badlogic.gdx.scenes.scene2d.utils.A
+import com.badlogic.gdx.scenes.scene2d.utils.ChangeL
+import com.badlogic.gdx.scenes.scene2d.utils.ClickL
+import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionD
+import com.china1169.impulsecontrol.assets.A
+import com.china1169.impulsecontrol.assets.MyP
+import com.china1169.impulsecontrol.assets.PreP
+import com.china1169.impulsecontrol.widget.ButtonV
+import com.sky.demon.game.screens.AbstractGameS
+import com.sky.demon.game.screens.DirectedG
+import com.sky.demon.game.utils.UiU
+import com.sky.demon.game.widget.ChooseCurrentL
+ * @author ldd
+ * 游戏准备界面
+public class PrepareGame extends AbstractGameScreen{
+ private Image backG//背景图片
+ private Label gameD//游戏描述
+ private ImageButton nextStepB//下一步按钮
+ private ImageButton escapePracticeB//跳过练习按钮
+ private ButtonView closeB//关闭按钮
+ private PreP
+ private MyP
+ public PrepareGame(DirectedGame game) {
super(game);
+ @Override
+ public void show() {
assetspic=Assets.instance.preA
point=Assets.instance.
///创建演员
backGround=new Image(assetspic.imageBg);
backGround.setFillParent(true);//设置为全屏显示
stage.addActor(backGround);
String introduceStr = &冲动控制训练可以帮助您改善您的意向控制能力。\n\n在训练开始前,您可先进行一次练习\n\n以帮助您更好地了解训练的操作方法。&;
LabelStyle labelStyle = new LabelStyle(Assets.instance.fonts.defaultBig, new Color(0f, 0f, 0f, 1f));
gameDescribe = new Label(introduceStr, labelStyle);
gameDescribe.setAlignment(Align.center);
stage.addActor(gameDescribe);
gameDescribe.setPosition(point.w / 2 - gameDescribe.getWidth() / 2, point.h/2);
nextStepBut = new ImageButton(new TextureRegionDrawable(assetspic.nextStepButUp), new TextureRegionDrawable(assetspic.nextStepButDown));
stage.addActor(nextStepBut);
nextStepBut.setPosition(point.w / 2 - nextStepBut.getWidth()*3 / 2, 200);
escapePracticeBut = new ImageButton(new TextureRegionDrawable(assetspic.escapePracticeButUp), new TextureRegionDrawable(assetspic.escapePracticeButDown));
stage.addActor(escapePracticeBut);
escapePracticeBut.setPosition(point.w / 2 + escapePracticeBut.getWidth()/ 2, 200);
closeBut = new ButtonView(&关 闭&);
closeBut.setPosition(point.w - closeBut.getWidth(), 200);
stage.addActor(closeBut);
//添加按钮监听
this.buttonAddListener();
ChooseCurrentLevel.showCurrentLevelChoose(stage,9,9);
+ private void buttonAddListener() {
nextStepBut.addListener(new ChangeListener() {
public void changed(ChangeEvent event, Actor actor) {
int currentLevel = ChooseCurrentLevel.getCheckCurrentLevel();
UiUtils.gotoScreen(game, new HelpScreen(game,currentLevel));
escapePracticeBut.addListener(new ChangeListener() {
public void changed(ChangeEvent event, Actor actor) {
int currentLevel = ChooseCurrentLevel.getCheckCurrentLevel();
UiUtils.gotoScreen(game, new GameScreen(game,currentLevel));
closeBut.addListener(new ClickListener(){
public void clicked(InputEvent event, float x, float y) {
Gdx.app.exit();
+ @Override
+ public void hide() {
+ @Override
+ public void pause() {
+ @Override
+ public void resize(int width, int height) {
super.resize(width, height);
backGround.setScale(mBgScale);
backGround.setPosition(mBgBeginPoint.x, mBgBeginPoint.y);
+ @Override
+ public void resume() {
super.resume();
+ @Override
+ public void dispose() {
super.dispose();
Index: screen/GameScreen.java
===================================================================
--- screen/GameScreen.java (revision 0)
+++ screen/GameScreen.java (revision 6)
@@ -0,0 +1,572 @@
+package com.china1169.impulsecontrol.
+import java.util.D
+import java.util.L
+import java.util.R
+import com.badlogic.gdx.G
+import com.badlogic.gdx.graphics.C
+import com.badlogic.gdx.graphics.T
+import com.badlogic.gdx.graphics.g2d.TextureR
+import com.badlogic.gdx.scenes.scene2d.A
+import com.badlogic.gdx.scenes.scene2d.S
+import com.badlogic.gdx.scenes.scene2d.T
+import com.badlogic.gdx.scenes.scene2d.ui.I
+import com.badlogic.gdx.scenes.scene2d.ui.ImageB
+import com.badlogic.gdx.scenes.scene2d.ui.L
+import com.badlogic.gdx.scenes.scene2d.ui.Label.LabelS
+import com.badlogic.gdx.scenes.scene2d.utils.A
+import com.badlogic.gdx.scenes.scene2d.utils.ChangeL
+import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionD
+import com.china1169.impulsecontrol.assets.A
+import com.china1169.impulsecontrol.assets.MyD
+import com.china1169.impulsecontrol.assets.MyP
+import com.china1169.impulsecontrol.assets.PreP
+import com.sky.demon.game.data.GameD
+import com.sky.demon.game.data.GameLiveD
+import com.sky.demon.game.data.PublicD
+import com.sky.demon.game.screens.AbstractGameS
+import com.sky.demon.game.screens.DirectedG
+import com.sky.demon.game.utils.UiU
+import com.sky.demon.game.utils.U
+ * @author ldd 游戏界面
+public class GameScreen extends AbstractGameScreen {
+ private Image backG// 背景图片
+ private PreP
+ private MyP
+ public S
+ private int currentLevel = 1;// 等级默认为1
+ private Image dgB// 左边打勾
+ private Image dxB// 左边打叉
+ private GameLiveData currentGameLiveD// 当前等级数据
+ private GameData currentGameD// 当前游戏数据
+ private ImageButton kbB// 确认按钮
+ private int questionN// 每一等级的题目数量
+ private double lvDengP// 绿灯的比例
+ private float showT//每张显示时间
+ private Image zuoLine1;
+ private Image zuoLine2;
+ private Image zuoLine3;
+ private Image htBlackLine1;
+ private Image htBlackLine2;
+ private Image htBlackLine3;
+ private int maxLevel = 9;// 最大等级
+ private List&Boolean& rightOrWrongL
+ private Image showP
+ private Random rand = new Random();
+ private int upPicP//上一次图片显示的位置
+ private boolean upLvOrH//上一次是绿或者红
+ private Label currDescL// 等级显示
+ public GameScreen(DirectedGame game,int currentLevel) {
super(game);
this.mestage =
this.currentLevel = currentL// PublicData.currentL
currentGameLiveData = new GameLiveData(currentLevel,new Date());
currentGameLiveData.setCountAnswered(true);
PublicData.gameLiveList.add(currentGameLiveData);
+ @Override
+ public void show() {
this.setPosition();
// 添加按钮监听
this.buttonAddListener();
+ public void init() {
getParam();
assetspic = Assets.instance.preA
point = Assets.instance.
// /创建演员
backGround = new Image(assetspic.imageBg);
backGround.setFillParent(true);// 设置为全屏显示
kbBut = new ImageButton(new TextureRegionDrawable(new TextureRegion(new Texture(Gdx.files.internal(&data/impulseControl/pics/bt_qr.PNG&)))),
new TextureRegionDrawable(new TextureRegion(new Texture(Gdx.files.internal(&data/impulseControl/pics/bt_qr1.PNG&)))));
dgBut = new Image(new TextureRegionDrawable(assetspic.rightPic));
dxBut = new Image(new TextureRegionDrawable(assetspic.wrongPic));
dgBut.setSize(270, 270);
dxBut.setSize(270, 270);
stage.addActor(backGround);
String currDescStr = &等级:&+currentL
LabelStyle labelStyle = new LabelStyle(
Assets.instance.fonts.defaultNormal, new Color(0f, 0f, 0f, 1f));
currDescLab = new Label(currDescStr, labelStyle);
currDescLab.setAlignment(Align.left);
currDescLab.setScale(0.5f);
stage.addActor(currDescLab);
currDescLab.setPosition(0, point.h - currDescLab.getPrefHeight());
times1Flag =
+ /* zuoLine1 =new Image(assetspic.vBlackLine);//左1边竖线
zuoLine1.setAlign(Align.center);
zuoLine1.setHeight(point.h/2);
zuoLine1.setPosition(point.w/2 - zuoLine1.getHeight()/2, point.h/3);
stage.addActor(zuoLine1);
zuoLine2 =new Image(assetspic.vBlackLine);//左2边竖线
zuoLine2.setAlign(Align.center);
zuoLine2.setHeight(point.h/2);
zuoLine2.setPosition(point.w/2 - zuoLine2.getHeight()/2 + point.h/2/3, point.h/3);
stage.addActor(zuoLine2);
zuoLine3 =new Image(assetspic.vBlackLine);//左3边竖线
zuoLine3.setAlign(Align.center);
zuoLine3.setHeight(point.h/2);
zuoLine3.setPosition(point.w/2 - zuoLine3.getHeight()/2 + point.h/2*2/3, point.h/3);
stage.addActor(zuoLine3);
Image vrBlackLine =new Image(assetspic.vBlackLine);//右边竖线
vrBlackLine.setAlign(Align.center);
vrBlackLine.setHeight(point.h/2);
vrBlackLine.setPosition(point.w/2 + vrBlackLine.getHeight()/2, point.h/3);
stage.addActor(vrBlackLine);
Sprite hSprite = new Sprite(assetspic.vBlackLine);
hSprite.setRotation(180);
htBlackLine1 =new Image(hSprite);//上1横线
htBlackLine1.setWidth(point.h/2);
htBlackLine1.setHeight(1);
htBlackLine1.setPosition(point.w/2 - htBlackLine1.getWidth()/2, point.h/3+point.h/2);
stage.addActor(htBlackLine1);
htBlackLine2 =new Image(hSprite);//上2横线
htBlackLine2.setWidth(point.h/2);
htBlackLine2.setHeight(1);
htBlackLine2.setPosition(point.w/2 - htBlackLine2.getWidth()/2, point.h/3+point.h/2 - point.h/2/3);
stage.addActor(htBlackLine2);
htBlackLine3 =new Image(hSprite);//上3横线
htBlackLine3.setWidth(point.h/2);
htBlackLine3.setHeight(1);
htBlackLine3.setPosition(point.w/2 - htBlackLine3.getWidth()/2, point.h/3+point.h/2- point.h/2*2/3);
stage.addActor(htBlackLine3);
Image hbBlackLine =new Image(hSprite);//下横线
hbBlackLine.setWidth(point.h/2);
hbBlackLine.setHeight(1);
hbBlackLine.setPosition(point.w/2 - hbBlackLine.getWidth()/2, point.h/3);
stage.addActor(hbBlackLine);*/
+ private void setShowPicPosition(){
int temp = rand.nextInt(9) + 1;
while(temp==upPicPosition){
temp = rand.nextInt(9) + 1;
upPicPosition =
float x1 = point.w/2 - point.h/2/2;
float x2 = point.w/2 - point.h/2/2 + point.h/2/3;
float x3 = point.w/2 - point.h/2/2 + point.h/2*2/3;
float y1 = point.h/3+point.h/2 - point.h/2/3;
float y2 = point.h/3+point.h/2- point.h/2*2/3;
float y3 = point.h/3;
if(upPicPosition == 1){
showPic.setPosition(x1, y1);
}else if(upPicPosition == 2){
showPic.setPosition(x2 , y1);
}else if(upPicPosition == 3){
showPic.setPosition(x3, y1);
}else if(upPicPosition == 4){
showPic.setPosition(x1, y2);
}else if(upPicPosition == 5){
showPic.setPosition(x2, y2);
}else if(upPicPosition == 6){
showPic.setPosition(x3 , y2);
}else if(upPicPosition == 7){
showPic.setPosition(x1 , y3);
}else if(upPicPosition == 8){
showPic.setPosition(x2 , y3);
}else if(upPicPosition == 9){
showPic.setPosition(x3 , y3);
+ private void updatePicShow(){
removeDxdg();
isAnswer =
upLvOrHong = rightOrWrongList.get(updatePicCount);
GameData gameData = new GameData(updatePicCount+1, new Date(),
currentLevel);
currentGameLiveData.getGameDataList().add(gameData);
currentGameData = gameD
kbBut.setTouchable(Touchable.enabled);
if(!upLvOrHong){//绿色
if(updatePicCount==0){
stage.addActor(kbBut);
showPic = new Image(assetspic.xjjImage);
showPic.setSize(168, 168);
stage.addActor(showPic);
setShowPicPosition();
showPic.setDrawable(new TextureRegionDrawable(assetspic.xjjImage));
setShowPicPosition();
if(updatePicCount==0){
stage.addActor(kbBut);
showPic = new Image(assetspic.shouImage);
showPic.setSize(168, 168);
stage.addActor(showPic);
setShowPicPosition();
showPic.setDrawable(new TextureRegionDrawable(assetspic.shouImage));
setShowPicPosition();
updatePicCount++;
+ private void noClickAnswer(){
if(!isAnswer){
System.out.println(&updatePicCount====&+updatePicCount);
if (currentGameData != null) {
currentGameData.setRight(upLvOrHong);
currentGameData.setEndDate(new Date());
currentGameData =
if (upLvOrHong) {
stage.addActor(dgBut);
stage.addActor(dxBut);
times1 = times1 - 0.2f;
isAnswer =
+ private void buttonAddListener() {
kbBut.addListener(new ChangeListener() {
public void changed(ChangeEvent event, Actor actor) {
answer(!upLvOrHong);
+ private boolean isA
+ private void answer(boolean answRightOrWrong){
if (isAnswer) {
isAnswer =
kbBut.setTouchable(Touchable.disabled);// 设置点击有效
if (currentGameData != null) {
currentGameData.setRight(answRightOrWrong);
currentGameData.setEndDate(new Date());
currentGameData =
if (answRightOrWrong) {
stage.addActor(dgBut);
stage.addActor(dxBut);
+ private void answerOver(){//答题结束
if (updatePicCount &= questionNums ) {// 已经完成本等级题目
currentGameLiveData.setEndDate(new Date());
double correct = currentGameLiveData.getCorrect();
if (correct == 1) {
PublicData.currentLevel = currentL
if (currentLevel &= maxLevel) {// 已经到最高等级,进入结束界面.....
showEndAlert();
showNextLevelAlert();
} else {// 显示是否重新玩
showPalyAgainAlert();//目前需求为完成每个等级的题目数量后就可以选择跳到下一级
if (currentLevel &= maxLevel) {// 已经到最高等级,进入结束界面.....
showEndAlert();
showNextLevelAlert();
times1Flag=
* 清除对错按钮
+ private void removeDxdg() {
if (dgBut != null) {
dgBut.remove();
if (dxBut != null) {
dxBut.remove();
+ public void gotoNextLevel() {
currentLevel++;
UiUtils.gotoScreen(game, new GameScreen(game, currentLevel));
+ public void showCompleteAlert() {
MyDialog.showCompleteAlert(stage, mBgBeginPoint.x, mBgBeginPoint.y,
new ChangeListener() {
public void changed(ChangeEvent event, Actor actor) {
palyAgainCurrentLevel();
}, new ChangeListener() {
public void changed(ChangeEvent event, Actor actor) {
UiUtils.gotoScreen(game, new ResultScreen(game));
+ public void showNextLevelAlert() {
MyDialog.showNextLevelAlert(stage, mBgBeginPoint.x, mBgBeginPoint.y,
new ChangeListener() {
public void changed(ChangeEvent event, Actor actor) {
gotoNextLevel();
}, new ChangeListener() {
public void changed(ChangeEvent event, Actor actor) {
UiUtils.gotoScreen(game, new ResultScreen(game));
+ public void showPalyAgainAlert() {
MyDialog.showPalyAgainAlert(stage, mBgBeginPoint.x, mBgBeginPoint.y,
new ChangeListener() {
public void changed(ChangeEvent event, Actor actor) {
palyAgainCurrentLevel();
}, new ChangeListener() {
public void changed(ChangeEvent event, Actor actor) {
UiUtils.gotoScreen(game, new ResultScreen(game));
* 重玩游戏
+ public void palyAgainCurrentLevel() {
UiUtils.gotoScreen(game, new GameScreen(game, currentLevel));
+ public void showEndAlert(){
MyDialog.showEndAlert(stage, mBgBeginPoint.x, mBgBeginPoint.y,
new ChangeListener() {
public void changed (ChangeEvent event, Actor actor) {
UiUtils.gotoScreen(game, new ResultScreen(game));
* 获取参数
+ public void getParam() {
if (currentLevel == 1) {
questionNums = 60;
lvDengProportion = 0.75;
showTime = 1.0f;
} else if (currentLevel == 2) {
questionNums = 60;
lvDengProportion = 0.8;
showTime = 1.0f;
} else if (currentLevel == 3) {
questionNums = 60;
lvDengProportion = 0.85;
showTime = 1.0f;
} else if (currentLevel == 4) {
questionNums = 60;
lvDengProportion = 0.9;
showTime = 1.0f;
} else if (currentLevel == 5) {
questionNums = 60;
lvDengProportion = 0.75;
showTime = 0.8f;
} else if (currentLevel == 6) {
questionNums = 60;
lvDengProportion = 0.8;
showTime = 0.8f;
} else if (currentLevel == 7) {
questionNums = 60;
lvDengProportion = 0.85;
showTime = 0.8f;
} else if (currentLevel == 8) {
questionNums = 60;
lvDengProportion = 0.9;
showTime = 0.8f;
} else if (currentLevel == 9) {
questionNums = 60;
lvDengProportion = 0.75;
showTime = 0.8f;
} /*else if (currentLevel == 10) {
questionNums = 60;
lvDengProportion = 0.8;
showTime = 0.5f;
} else if (currentLevel == 11) {
questionNums = 60;
lvDengProportion = 0.5;
showTime = 0.5f;
} else if (currentLevel == 12) {
questionNums = 60;
lvDengProportion = 0.9;
showTime = 0.5f;
/*else if (currentLevel == 13) {
questionNums = 60;
lvDengProportion = 0.75;
showTime = 500;
} else if (currentLevel == 14) {
questionNums = 60;
lvDengProportion = 0.8;
showTime = 500;
} else if (currentLevel == 15) {
questionNums = 60;
lvDengProportion = 0.85;
showTime = 500;
} else if (currentLevel == 16) {
questionNums = 60;
lvDengProportion = 0.9;
showTime = 0.2f;
rightOrWrongList = Utils.getSameAndNoSameIndex(questionNums,
lvDengProportion);
* 位置拜放
+ private void setPosition() {
if (kbBut != null) {
kbBut.setPosition(point.w / 2 - kbBut.getWidth() / 2, 100);
dgBut.setPosition(point.w / 2 - dgBut.getWidth() / 2, point.h / 2
- dgBut.getHeight() / 2 + 70);
dxBut.setPosition(point.w / 2 - dxBut.getWidth() / 2, point.h / 2
- dxBut.getHeight() / 2 + 70);
+ @Override
+ public void hide() {
+ @Override
+ public void pause() {
+ public enum GameState {
* 游戏进行中
* 游戏结束
+ @Override
+ public void resize(int width, int height) {
super.resize(width, height);
backGround.setScale(mBgScale);
backGround.setPosition(mBgBeginPoint.x, mBgBeginPoint.y);
+ @Override
+ public void resume() {
super.resume();
+ private float times1;// 每张图片显示的时间计时。用于切换图片
+ private boolean times1F// 标识
+ private int updatePicCount = 0;//图片切换次数
+ @Override
+ public void render(float deltaTime) {
super.render(deltaTime);
if(times1Flag){
times1+=deltaT
if(updatePicCount==0){
if(times1&=0.3f){
updatePicShow();
times1 = 0;
if(times1&=showTime){
if(!isAnswer && updatePicCount!=0){
noClickAnswer();
if(updatePicCount&questionNums){
updatePicShow();
times1 = 0;
answerOver();
if(updatePicCount&questionNums){
times1Flag=
+ @Override
+ public void dispose() {
super.dispose();
Index: screen/ResultScreen.java
===================================================================
--- screen/ResultScreen.java (revision 0)
+++ screen/ResultScreen.java (revision 6)
@@ -0,0 +1,194 @@
+package com.china1169.impulsecontrol.
+import java.text.DecimalF
+import java.util.L
+import com.badlogic.gdx.G
+import com.badlogic.gdx.graphics.C
+import com.badlogic.gdx.scenes.scene2d.A
+import com.badlogic.gdx.scenes.scene2d.S
+import com.badlogic.gdx.scenes.scene2d.T
+import com.badlogic.gdx.scenes.scene2d.actions.A
+import com.badlogic.gdx.scenes.scene2d.ui.I
+import com.badlogic.gdx.scenes.scene2d.ui.ImageB
+import com.badlogic.gdx.scenes.scene2d.ui.L
+import com.badlogic.gdx.scenes.scene2d.ui.Label.LabelS
+import com.badlogic.gdx.scenes.scene2d.ui.ScrollP
+import com.badlogic.gdx.scenes.scene2d.ui.T
+import com.badlogic.gdx.scenes.scene2d.utils.A
+import com.badlogic.gdx.scenes.scene2d.utils.ChangeL
+import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionD
+import com.china1169.impulsecontrol.assets.A
+import com.china1169.impulsecontrol.assets.MyP
+import com.china1169.impulsecontrol.assets.PreP
+import com.sky.demon.game.data.GameLiveD
+import com.sky.demon.game.data.PublicD
+import com.sky.demon.game.screens.AbstractGameS
+import com.sky.demon.game.screens.DirectedG
+ * 结果报表界面
+ * @author zgc
+public class ResultScreen extends AbstractGameScreen {
+ private Image backG//背景图片
+ private PreP
+ private MyP
+ public S
+ private T
+ private ImageButton endGameB//结束游戏按钮
+ private ImageButton exportB//导出报表按钮
+ public ResultScreen(DirectedGame game) {
super(game);
this.mestage=
+ @Override
+ public void show() {
assetspic=Assets.instance.preA
point=Assets.instance.
///创建演员
backGround=new Image(assetspic.imageBg);
backGround.setFillParent(true);//设置为全屏显示
stage.addActor(backGround);
endGameBut = new ImageButton(new TextureRegionDrawable(assetspic.endGameButUp), new TextureRegionDrawable(assetspic.endGameButDown));
endGameBut.setPosition(point.w / 2 - endGameBut.getWidth()*3/2, 50 );
stage.addActor(endGameBut);
exportBut = new ImageButton(new TextureRegionDrawable(assetspic.exportButUp), new TextureRegionDrawable(assetspic.exportButDown));
exportBut.setPosition(point.w / 2 + exportBut.getWidth()/2, 50 );
stage.addActor(exportBut);
table = new Table();
table.align(Align.center);
ScrollPane scrollPane = new ScrollPane(table, new ScrollPane.ScrollPaneStyle());
scrollPane.setFlickScroll(false);
stage.addActor(scrollPane);
int row = 0;
float pad = 20f;
LabelStyle labelStyle = new LabelStyle(Assets.instance.fonts.defaultNormal, new Color(0f, 0f, 0f, 1f));
Label bcxldj = new Label(&本次训练等级&, labelStyle);
table.add(bcxldj).pad(pad);
Label zsj = new Label(&训练总时间&, labelStyle);
table.add(zsj).pad(pad);
Label pjfysj = new Label(&平均反应时间&, labelStyle);
table.add(pjfysj).pad(pad);
Label zql = new Label(&正确率&, labelStyle);
table.add(zql).pad(pad);
table.row();
List&GameLiveData& gameLiveList = PublicData.gameLiveL
if(gameLiveList!=null && gameLiveList.size()&0){
for(GameLiveData gameLiveData : gameLiveList){
table.row();
DecimalFormat df = new DecimalFormat(&0.00&);//保留小数点后2位
long allTime = gameLiveData.getAllTime();
long avgTime = gameLiveData.getAvgTime();//
double correct = gameLiveData.getCorrect()*100;
String allTimeStr = df.format((allTime*1.0/(60*1000)));//分钟
String avgTimeStr = df.format((avgTime*1.0/1000));//秒
String correctStr = df.format(correct);
Label dj = new Label(&等级 &+gameLiveData.getCurrentLevel(), labelStyle);
table.add(dj).pad(pad);
Label allTimeLabel = new Label(allTimeStr+& 分钟&, labelStyle);
table.add(allTimeLabel).pad(pad);
Label avgTimeLabel = new Label(avgTimeStr+& 秒&, labelStyle);
table.add(avgTimeLabel).pad(pad);
Label correctLabel = new Label(correctStr+&%&, labelStyle);
table.add(correctLabel).pad(pad);
scrollPane.setHeight(point.h*3/4);
scrollPane.setWidth(point.w*3/4);
scrollPane.setPosition(point.w/2-scrollPane.getWidth()/2, point.h*3/8-scrollPane.getHeight()/2+200);
scrollPane.setScrollBarPositions(false, true);
//添加按钮监听
this.buttonAddListener();
+ private void buttonAddListener() {
// TODO Auto-generated method stub
endGameBut.addListener(new ChangeListener() {
public void changed (ChangeEvent event, Actor actor) {
System.out.println(&---game over---&);
Gdx.app.exit();
exportBut.addListener(new ChangeListener() {
public void changed (ChangeEvent event, Actor actor) {
exportBut.setTouchable(Touchable.disabled);
boolean result = PublicData.exportResultToExcel(&c:\\rz_report&,&冲动控制&);
String str = &&;
if(result){
str = &成功导出到c:\\rz_report&;
str = &导出失败&;
LabelStyle labelStyle = new LabelStyle(Assets.instance.fonts.defaultNormal, Color.RED);
Label label = new Label(str, labelStyle);
label.setPosition(point.w/2-label.getWidth()/2, 250);
stage.addActor(label);
label.addAction(Actions.sequence(Actions.fadeIn(0.2f), Actions.delay(1f), Actions.fadeOut(0.2f)));
exportBut.setTouchable(Touchable.enabled);
+ @Override
+ public void hide() {
+ @Override
+ public void pause() {
+ @Override
+ public void resize(int width, int height) {
super.resize(width, height);
backGround.setScale(mBgScale);
backGround.setPosition(mBgBeginPoint.x, mBgBeginPoint.y);
+ @Override
+ public void resume() {
super.resume();
+ @Override
+ public void render(float deltaTime) {
super.render(deltaTime);
+ @Override
+ public void dispose() {
super.dispose();
Index: screen/ResultScreen2.java
===================================================================
--- screen/ResultScreen2.java (revision 0)
+++ screen/ResultScreen2.java (revision 6)
@@ -0,0 +1,270 @@
+package com.china1169.impulsecontrol.
+import java.io.F
+import java.util.ArrayL
+import java.util.I
+import java.util.L
+import java.util.M
+import com.badlogic.gdx.G
+import com.badlogic.gdx.graphics.C
+import com.badlogic.gdx.scenes.scene2d.A
+import com.badlogic.gdx.scenes.scene2d.S
+import com.badlogic.gdx.scenes.scene2d.T
+import com.badlogic.gdx.scenes.scene2d.actions.A
+import com.badlogic.gdx.scenes.scene2d.ui.I
+import com.badlogic.gdx.scenes.scene2d.ui.ImageB
+import com.badlogic.gdx.scenes.scene2d.ui.L
+import com.badlogic.gdx.scenes.scene2d.ui.ScrollP
+import com.badlogic.gdx.scenes.scene2d.ui.Label.LabelS
+import com.badlogic.gdx.scenes.scene2d.ui.T
+import com.badlogic.gdx.scenes.scene2d.utils.ChangeL
+import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionD
+import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeE
+import com.china1169.impulsecontrol.assets.A
+import com.china1169.impulsecontrol.assets.MyP
+import com.china1169.impulsecontrol.assets.PreP
+import com.sky.demon.game.data.PublicD
+import com.sky.demon.game.screens.AbstractGameS
+import com.sky.demon.game.screens.DirectedG
+import com.sky.demon.game.utils.ExcelT
+import com.sky.demon.game.utils.U
+ * 结果报表界面
+ * @author ldd
+public class ResultScreen2 extends AbstractGameScreen {
+ private Image backG//背景图片
+ private PreP
+ private MyP
+ public S
+ private T
+ private ImageButton endGameB//结束游戏按钮
+ private ImageButton exportB//导出报表按钮
+ private Map&String,List&Object&& resultM
+ public ResultScreen2(DirectedGame game,Map&String,List&Object&& resultMap) {
super(game);
this.mestage=
this.resultMap = resultM
+ @Override
+ public void show() {
assetspic=Assets.instance.preA
point=Assets.instance.
///创建演员
backGround=new Image(assetspic.imageBg);
backGround.setFillParent(true);//设置为全屏显示
stage.addActor(backGround);
endGameBut = new ImageButton(new TextureRegionDrawable(assetspic.endGameButUp), new TextureRegionDrawable(assetspic.endGameButDown));
endGameBut.setPosition(point.w / 2 - endGameBut.getWidth()/2 - endGameBut.getWidth(), 50 );
stage.addActor(endGameBut);
exportBut = new ImageButton(new TextureRegionDrawable(assetspic.exportButUp), new TextureRegionDrawable(assetspic.exportButDown));
exportBut.setPosition(point.w / 2 - exportBut.getWidth()/2 + exportBut.getWidth(), 50 );
stage.addActor(exportBut);
table = new Table();
stage.addActor(table);
ScrollPane scrollPane = new ScrollPane(table, new ScrollPane.ScrollPaneStyle());
scrollPane.setFlickScroll(false);
stage.addActor(scrollPane);
int row = 0;
float pad = 20f;
LabelStyle labelStyle = new LabelStyle(Assets.instance.fonts.defaultNormal, new Color(0f, 0f, 0f, 1f));
Label bcxldj = new Label(&本次训练等级&, labelStyle);
table.add(bcxldj).pad(pad);
Label zsj = new Label(&训练总时间&, labelStyle);
table.add(zsj).pad(pad);
Label pjfysj = new Label(&平均反应时间&, labelStyle);
table.add(pjfysj).pad(pad);
Label zql = new Label(&正确率&, labelStyle);
table.add(zql).pad(pad);
table.row();
Image line1 =new Image(assetspic.vBlackLine);
table.add(line1);
Image line2 =new Image(assetspic.vBlackLine);
table.add(line2);
for (Iterator&String& keys = resultMap.keySet().iterator(); keys.hasNext();) {
table.row();
String key = (String) keys.next();
Label dj = new Label(&等级 &+key, labelStyle);
table.add(dj).pad(pad);
List&Object& value = resultMap.get(key);
int i = 0;
for (Object obj : value) {
Label allTimeLabel = new Label(obj+& 分钟&, labelStyle);
table.add(allTimeLabel).pad(pad);
}else if(i==1){
Label avgTimeLabel = new Label(obj+& 秒&, labelStyle);
table.add(avgTimeLabel).pad(pad);
Label correctLabel = new Label(obj+&%&, labelStyle);
table.add(correctLabel).pad(pad);
+ /* List&GameLiveData& gameLiveList = PublicData.gameLiveL
if(gameLiveList!=null && gameLiveList.size()&0){
for(GameLiveData gameLiveData : gameLiveList){
table.row();
DecimalFormat df = new DecimalFormat(&0.00&);//保留小数点后2位
long allTime = gameLiveData.getAllTime();
long avgTime = gameLiveData.getAvgTime();//
double correct = gameLiveData.getCorrect()*100;
String allTimeStr = df.format((allTime*1.0/(60*1000)));//分钟
String avgTimeStr = df.format((avgTime*1.0/1000));//秒
String correctStr = df.format(correct);
Label dj = new Label(&等级 &+gameLiveData.getCurrentLevel(), labelStyle);
table.add(dj).pad(pad);
Label allTimeLabel = new Label(allTimeStr+& 分钟&, labelStyle);
table.add(allTimeLabel).pad(pad);
Label avgTimeLabel = new Label(avgTimeStr+& 秒&, labelStyle);
table.add(avgTimeLabel).pad(pad);
Label correctLabel = new Label(correctStr+&%&, labelStyle);
table.add(correctLabel).pad(pad);
System.out.println(row+&---point.h/2-row*100---&&+(point.h/2-row*35));
table.setPosition(point.w / 2, point.h*3/4-(row*35)/2);
scrollPane.setHeight(point.h*3/4);
scrollPane.setWidth(point.w*3/4);
scrollPane.setPosition(point.w/2-scrollPane.getWidth()/2, point.h*3/8-scrollPane.getHeight()/2+200);
scrollPane.setScrollBarPositions(false, true);
//添加按钮监听
this.buttonAddListener();
+ private void buttonAddListener() {
// TODO Auto-generated method stub
endGameBut.addListener(new ChangeListener() {
public void changed (ChangeEvent event, Actor actor) {
System.out.println(&---game over---&);
Gdx.app.exit();
exportBut.addListener(new ChangeListener() {
public void changed (ChangeEvent event, Actor actor) {
exportBut.setTouchable(Touchable.disabled);
boolean result = this.exportResultToExcel(&c:\\rz_report&,&持续性注意训练&);
String str = &&;
if(result){
str = &成功导出到c:\\rz_report&;
str = &导出失败&;
LabelStyle labelStyle = new LabelStyle(Assets.instance.fonts.defaultNormal, Color.RED);
Label label = new Label(str, labelStyle);
label.setPosition(point.w/2-label.getWidth()/2, 250);
stage.addActor(label);
label.addAction(Actions.sequence(Actions.fadeIn(0.2f), Actions.delay(1f), Actions.fadeOut(0.2f)));
exportBut.setTouchable(Touchable.enabled);
private boolean exportResultToExcel(String filePath,String name) {
File file = new File(filePath);
if(!file.exists()){
file.mkdirs();
= filePath+&/&+name+Utils.getDate14()+&.xls&;
String[] titles = {&编号&, &本次训练等级&, &训练总时间(分钟)&,&平均反应时间(秒)&,&正确率&};//标题
List&String[]& list = new ArrayList&String[]&();//每行数据列表
for (Iterator&String& keys = resultMap.keySet().iterator(); keys.hasNext();) {
table.row();
String key = (String) keys.next();
List&Object& value = resultMap.get(key);
int i = 0;
String[] data = new String[5];
data[0] = (i+1)+&&;
data[1] = &等级 &+
for (Object obj : value) {
data[2] = obj.toString();
}else if(i==1){
data[3] = obj.toString();
data[4] = obj.toString();
list.add(data);
return ExcelTool.exportDataToExcel(titles, list, filePath);
+ @Override
+ public void hide() {
+ @Override
+ public void pause() {
+ @Override
+ public void resize(int width, int height) {
super.resize(width, height);
backGround.setScale(mBgScale);
backGround.setPosition(mBgBeginPoint.x, mBgBeginPoint.y);
+ @Override
+ public void resume() {
super.resume();
+ @Override
+ public void render(float deltaTime) {
super.render(deltaTime);
+ @Override
+ public void dispose() {
super.dispose();
Index: assets/MyPoint.java
===================================================================
--- assets/MyPoint.java (revision 0)
+++ assets/MyPoint.java (revision 6)
@@ -0,0 +1,51 @@
+package com.china1169.impulsecontrol.
+import com.badlogic.gdx.G
+import com.sky.demon.game.GameC
+import com.sky.demon.game.screens.PcsP
+ * @author Z
+ * 位置控制类
+public class MyPoint {
+ public PcsPoint imageI
+ public PcsPoint imageWiBg;
+ public PcsPoint titleI
+ public PcsPoint backI
+ public PcsPoint keepI
+ public PcsPoint startI
+ public PcsPoint introI
+ public PcsPoint titleT
+ public PcsPoint overTitleT
+ public PcsPoint introC
+ public PcsPoint overC
+ public MyPoint() {
h = GameConfig.instance.viewport_gui_
w = GameConfig.instance.viewport_gui_
System.out.println(Gdx.graphics.getHeight()+&--h--&&+h+&--w--&&+w+&---&&+Gdx.graphics.getWidth());
imageIntroduce = new PcsPoint((w-512)/2, h-100);
imageWiBg = new PcsPoint(110, h - 856);
titleImage = new PcsPoint(662, h - 332);
overTitleText = new PcsPoint(630, h - 332);
backImage = new PcsPoint(54, h - 132);
startImage = new PcsPoint(1392, h - 850);
keepImage = new PcsPoint(1392, h - 1018);
introImage = new PcsPoint(1392, h - 1018);
titleText = new PcsPoint(732, h - 254);
overContent = new PcsPoint(600, h - 600);
introContent = new PcsPoint(280, h - 600);
Index: assets/Assets.java
===================================================================
--- assets/Assets.java (revision 0)
+++ assets/Assets.java (revision 6)
@@ -0,0 +1,125 @@
+package com.china1169.impulsecontrol.
+import java.util.D
+import com.badlogic.gdx.G
+import com.badlogic.gdx.assets.AssetD
+import com.badlogic.gdx.assets.AssetErrorL
+import com.badlogic.gdx.assets.AssetM
+import com.badlogic.gdx.audio.S
+import com.badlogic.gdx.graphics.Texture.TextureF
+import com.badlogic.gdx.graphics.g2d.BitmapF
+import com.badlogic.gdx.graphics.g2d.TextureA
+import com.badlogic.gdx.utils.D
+ * @author Z
+ * 资源加载
+public class Assets implements Disposable, AssetErrorListener {
+ public static final String TAG = Assets.class.getName();
+ public static final Assets instance = new Assets();
+ public boolean soundplay =
+ public AssetManager assetM
+ public AssetF
+ public GameObjectsAssets gameObjectsA
+ public PrePic preA
+ public MyP
+ private Assets() {
+ public void init(AssetManager assetManager) {
Date dt = new Date();
long timed = dt.getTime();
this.assetManager = assetM
assetManager.setErrorListener(this);
// 加载开始界面的游戏资源
assetManager.load(&data/impulseControl/pics/impulsecontrol.pack&, TextureAtlas.class);
assetManager.load(&data/impulseControl/pics/hdld.pack&, TextureAtlas.class);
assetManager.load(&data/publicpic/pics/publicpic.pack&, TextureAtlas.class);
assetManager.load(&data/publicpic/pics/public_pic.pack&, TextureAtlas.class);
assetManager.load(&data/impulseControl/font/font32.fnt&, BitmapFont.class);
assetManager.load(&data/sustainedAttention/font/3.fnt&, BitmapFont.class);
assetManager.load(&data/sustainedAttention/font/7.fnt&, BitmapFont.class);
assetManager.load(&data/sound/right.mp3&, Sound.class);
assetManager.load(&data/sound/error.mp3&, Sound.class);
assetManager.load(&data/sound/RectSmall.mp3&, Sound.class);
assetManager.finishLoading();
Date dt2 = new Date();
gameObjectsAssets = new GameObjectsAssets(assetManager);
gameObjectsAssets.loading();
fonts = new AssetFonts(assetManager);
fonts.loading();
preAssect = new PrePic(assetManager);
preAssect.loading();
point = new MyPoint();
+ @Override
+ public void dispose() {
assetManager.dispose();
if (fonts.defaultSmall != null) {
fonts.defaultSmall.dispose();
if (fonts.defaultNormal != null) {
fonts.defaultNormal.dispose();
if (fonts.defaultBig != null) {
fonts.defaultBig.dispose();
// fonts.defaultSmall.dispose();
// fonts.defaultNormal.dispose();
// fonts.defaultBig.dispose();
* @author Z
+ public class AssetFonts {
public BitmapFont defaultS
public BitmapFont defaultN
public BitmapFont defaultB
public BitmapFont overDefaultB
public BitmapFont titleS
public BitmapFont numS
private AssetManager assetM
public AssetFonts(AssetManager assetManager) {
this.assetManager = assetM
public void loading() {
defaultBig = assetManager.get(&data/impulseControl/font/font32.fnt&);
//defaultBig = new BitmapFont(Gdx.files.internal(&data/VisualAttention/font/font32.fnt&), false);
defaultBig.setScale(2.0f);
defaultBig.getRegion().getTexture().setFilter(TextureFilter.Linear, TextureFilter.Linear);
defaultNormal = new BitmapFont(Gdx.files.internal(&data/publicpic/pics/result.fnt&), false);
defaultNormal.setScale(1.0f);
defaultNormal.getRegion().getTexture().setFilter(TextureFilter.Linear, TextureFilter.Linear);
numSan = new BitmapFont(Gdx.files.internal(&data/publicpic/pics/but_font.fnt&), false);
numSan.setScale(1.125f);
numSan.getRegion().getTexture().setFilter(TextureFilter.Linear, TextureFilter.Linear);
+ @Override
+ public void error(AssetDescriptor asset, Throwable throwable) {
Index: assets/PrePic.java
===================================================================
--- assets/PrePic.java (revision 0)
+++ assets/PrePic.java (revision 6)
@@ -0,0 +1,133 @@
+package com.china1169.impulsecontrol.
+import com.badlogic.gdx.assets.AssetM
+import com.badlogic.gdx.graphics.g2d.TextureA
+import com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasR
+import com.badlogic.gdx.graphics.g2d.TextureR
+import com.badlogic.gdx.utils.A
+ * @author Z
+ * 开始界面资源
+public class PrePic {
+ public TextureRegion imageBg;//开始界面背景
+ public TextureRegion imageI//游戏介绍图片
+ public TextureRegion confirmButUp;//确认按钮未按下
+ public TextureRegion confirmButD//确认按钮按下
+ public TextureRegion kbButUp;//空白按钮
+ public TextureRegion kbButD//空白按钮按下
+ public TextureRegion rightP//正确图片
+ public TextureRegion wrongP//错误图片
+ public TextureRegion nextLevelA//提示下一等级提示框
+ public TextureRegion alertC//提示完成提示框
+ public TextureRegion imageBgHs;//灰色背景
+ public AtlasRegion regionBgHs;//灰色背景
+ public TextureRegion maskL//遮罩层
+ public TextureRegion alertB//提示提示框背景
+ public TextureRegion alertPalyA//提示重新玩提示框
+ public TextureRegion alertNextL//提示下一等级提示框
+ public TextureRegion nextLevelButUp;//下一等级按钮未按下
+ public TextureRegion nextLevelButD//下一等级按钮按下
+ public TextureRegion endGameButUp;//结束游戏按钮未按下
+ public TextureRegion endGameButD//结束游戏按钮按下
+ public TextureRegion palyAgainButUp;//再完一次游戏按钮未按下
+ public TextureRegion palyAgainButD//再完一次游戏按钮按下
+ public Array&AtlasRegion&
jxL//矩形列表
+ public TextureRegion nextStepButUp;//下一步按钮未按下
+ public TextureRegion nextStepButD//下一步按钮按下
+ public TextureRegion escapePracticeButUp;//跳过练习按钮未按下
+ public TextureRegion escapePracticeButD//跳过练习按钮按下
+ public TextureRegion startGameButUp;//开始游戏按钮未按下
+ public TextureRegion startGameButD//开始游戏按钮按下
+ public TextureRegion previousStepButUp;//上一步按钮未按下
+ public TextureRegion previousStepButD//上一步按钮按下
+ public TextureRegion hBlackL//横黑线
+ public TextureRegion vBlackL//竖黑线
+ public TextureRegion imageWiBg;
+ public TextureRegion titleI
+ public TextureRegion backI
+ public TextureRegion keepI
+ public TextureRegion startI
+ public TextureRegion introI
+ public TextureRegion xjjI//小鸡鸡
+ public TextureRegion shouI//手
+ public TextureRegion exportButUp;//导出按钮未按下
+ public TextureRegion exportButD//导出按钮按下
+ public TextureRegion butUpBg;//按钮未按下背景
+ public TextureRegion butDownBg;//按钮按下背景
+ AssetManager assetM
+ public PrePic(AssetManager assetManager) {
this.assetManager = assetM
+ public void loading() {
TextureAtlas preatlas = assetManager.get(&data/impulseControl/pics/impulsecontrol.pack&);
imageBg = preatlas.findRegion(&bg2&);
imageIntroduce = preatlas.findRegion(&bg3&);
confirmButUp = preatlas.findRegion(&btn_qd2&);
confirmButDown = preatlas.findRegion(&btn_qd1&);
kbButUp = preatlas.findRegion(&btn_bk4&);
kbButDown = preatlas.findRegion(&btn_kb3&);
nextLevelAlert = preatlas.findRegion(&bg5&);
nextLevelButUp = preatlas.findRegion(&bt_jrxydj&);
nextLevelButDown = preatlas.findRegion(&bt_jrxydj1&);
endGameButUp = preatlas.findRegion(&bt_jsyx&);
endGameButDown = preatlas.findRegion(&bt_jsyx1&);
imageBgHs = preatlas.findRegion(&bg1&);
regionBgHs = preatlas.findRegion(&bg1&);
maskLayer = preatlas.findRegion(&mask_layer&);
alertBackground = preatlas.findRegion(&alert_background&);
alertPalyAgain = preatlas.findRegion(&alert_palyAgain&);
alertNextLevel = preatlas.findRegion(&alert_nextLevel&);
palyAgainButUp = preatlas.findRegion(&bt_jxyx&);
palyAgainButDown = preatlas.findRegion(&bt_jxyx1&);
alertComplete = preatlas.findRegion(&alert_complete&);
TextureAtlas preatlas4 = assetManager.get(&data/impulseControl/pics/hdld.pack&);
xjjImage = preatlas4.findRegion(&xjj&);
shouImage = preatlas4.findRegion(&shou&);
TextureAtlas preatlas2 = assetManager.get(&data/publicpic/pics/publicpic.pack&);
exportButUp = preatlas2.findRegion(&bt_export&);
exportButDown = preatlas2.findRegion(&bt_export1&);
TextureAtlas preatlas3 = assetManager.get(&data/publicpic/pics/public_pic.pack&);
nextStepButUp = preatlas3.findRegion(&bt_xyb&);
nextStepButDown = preatlas3.findRegion(&bt_xyb1&);
escapePracticeButUp = preatlas3.findRegion(&bt_tglx&);
escapePracticeButDown = preatlas3.findRegion(&bt_tglx1&);
startGameButUp = preatlas3.findRegion(&bt_ksyx&);
startGameButDown = preatlas3.findRegion(&bt_ksyx1&);
previousStepButUp = preatlas3.findRegion(&bt_syb&);
previousStepButDown = preatlas3.findRegion(&bt_syb1&);
vBlackLine = preatlas3.findRegion(&black_line&);
maskLayer = preatlas3.findRegion(&mask_layer&);
butUpBg = preatlas3.findRegion(&bt_bg&);
butDownBg = preatlas3.findRegion(&bt_bg1&);
rightPic = preatlas3.findRegion(&right&);
wrongPic = preatlas3.findRegion(&wrong&);
Index: assets/MyDialog.java
===================================================================
--- assets/MyDialog.java (revision 0)
+++ assets/MyDialog.java (revision 6)
@@ -0,0 +1,197 @@
+package com.china1169.impulsecontrol.
+import com.badlogic.gdx.graphics.C
+import com.badlogic.gdx.scenes.scene2d.A
+import com.badlogic.gdx.scenes.scene2d.EventL
+import com.badlogic.gdx.scenes.scene2d.S
+import com.badlogic.gdx.scenes.scene2d.ui.I
+import com.badlogic.gdx.scenes.scene2d.ui.ImageB
+import com.badlogic.gdx.scenes.scene2d.ui.W
+import com.badlogic.gdx.scenes.scene2d.ui.Window.WindowS
+import com.badlogic.gdx.scenes.scene2d.utils.ChangeL
+import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionD
+ * 提示框
+ * @author zgc
+public class MyDialog {
* 显示下一等级alert
* @param stage
* @param xLayer 遮罩层X位置坐标
* @param yLayer 遮罩层Y位置坐标
* @param nextLevelListener 下一等级按钮监听事件
* @param endGameListener 结束游戏按钮监听事件
+ public static void showNextLevelAlert(Stage stage,float xLayer,float yLayer,EventListener nextLevelListener,EventListener endGameListener){
PrePic assetspic=Assets.instance.preA
MyPoint point = Assets.instance.
TextureRegionDrawable alertBackground =
new TextureRegionDrawable(assetspic.alertNextLevel);
WindowStyle style = new WindowStyle(Assets.instance.fonts.defaultBig, Color.BLACK,alertBackground);
final Window dialogWindow = new Window(&&, style);
dialogWindow.setWidth(alertBackground.getMinWidth());
dialogWindow.setHeight(alertBackground.getMinHeight());
//dialogWindow.setWidth(point.w/2f);
//dialogWindow.setHeight(point.h/2f);
dialogWindow.setPosition(point.w/2-dialogWindow.getWidth()/2,point.h/2-dialogWindow.getHeight()/2);
dialogWindow.setMovable(true);
ImageButton nextLevelBut = new ImageButton(new TextureRegionDrawable(assetspic.nextLevelButUp), new TextureRegionDrawable(assetspic.nextLevelButDown));
ImageButton endGameBut = new ImageButton(new TextureRegionDrawable(assetspic.endGameButUp), new TextureRegionDrawable(assetspic.endGameButDown));
nextLevelBut.setPosition(dialogWindow.getWidth()/2-nextLevelBut.getWidth()-20, 100);
endGameBut.setPosition(dialogWindow.getWidth()/2+20, 100);
dialogWindow.addActor(nextLevelBut);
dialogWindow.addActor(endGameBut);
final Image maskLayer=new Image(assetspic.maskLayer);
maskLayer.setFillParent(true);//设置为全屏显示
maskLayer.setPosition(xLaye

我要回帖

更多关于 领导上场音乐 的文章

 

随机推荐