LCD 重新显示回时间而非比分

This commit is contained in:
CalciteM Team 2019-08-03 11:34:15 +08:00
parent f271c6d483
commit 1e3365ec03
2 changed files with 18 additions and 7 deletions

View File

@ -94,6 +94,9 @@
// 启动时窗口最大化
//#define SHOW_MAXIMIZED_ON_LOAD
//#define LCD_SHOW_SCORE_INSTEAD_OF_TIME
// 不使用哈希桶
#define DISABLE_HASHBUCKET

View File

@ -149,8 +149,10 @@ void GameController::gameReset()
}
}
#ifdef LCD_SHOW_SCORE_INSTEAD_OF_TIME
emit time1Changed(QString::number(score1, 10));
emit time2Changed(QString::number(score2, 10));
#endif /* LCD_SHOW_SCORE_INSTEAD_OF_TIME */
// 重置游戏
chess_.reset();
@ -226,9 +228,11 @@ void GameController::gameReset()
currentRow = 0;
// 发出信号通知主窗口更新LCD显示
//QTime qtime = QTime(0, 0, 0, 0).addMSecs(remainingTime1);
//emit time1Changed(qtime.toString("mm:ss.zzz"));
//emit time2Changed(qtime.toString("mm:ss.zzz"));
#ifndef LCD_SHOW_SCORE_INSTEAD_OF_TIME
QTime qtime = QTime(0, 0, 0, 0).addMSecs(remainingTime1);
emit time1Changed(qtime.toString("mm:ss.zzz"));
emit time2Changed(qtime.toString("mm:ss.zzz"));
#endif /* ! LCD_SHOW_SCORE_INSTEAD_OF_TIME */
// 发信号更新状态栏
message = QString::fromStdString(chess_.getTips());
@ -538,11 +542,13 @@ void GameController::timerEvent(QTimerEvent *event)
remainingTime2 = timeLimit * 60000 - remainingTime2;
}
//qt1 = QTime(0, 0, 0, 0).addMSecs(remainingTime1);
//qt2 = QTime(0, 0, 0, 0).addMSecs(remainingTime2);
#ifndef LCD_SHOW_SCORE_INSTEAD_OF_TIME
qt1 = QTime(0, 0, 0, 0).addMSecs(remainingTime1);
qt2 = QTime(0, 0, 0, 0).addMSecs(remainingTime2);
//emit time1Changed(qt1.toString("mm:ss.zzz"));
//emit time2Changed(qt2.toString("mm:ss.zzz"));
emit time1Changed(qt1.toString("mm:ss.zzz"));
emit time2Changed(qt2.toString("mm:ss.zzz"));
#endif /* ! LCD_SHOW_SCORE_INSTEAD_OF_TIME */
// 如果胜负已分
if (chess_.whoWin() != NineChess::NOBODY) {
@ -565,8 +571,10 @@ void GameController::timerEvent(QTimerEvent *event)
score2++;
}
#ifdef LCD_SHOW_SCORE_INSTEAD_OF_TIME
emit time1Changed(QString::number(score1, 10));
emit time2Changed(QString::number(score2, 10));
#endif /* LCD_SHOW_SCORE_INSTEAD_OF_TIME */
// 播放音效
#ifndef DONOT_PLAY_WIN_SOUND