parent
0b4366b289
commit
1f8a7fa485
|
@ -278,6 +278,7 @@
|
|||
<addaction name="actionEngine1_T"/>
|
||||
<addaction name="actionEngine2_R"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionAutoChangeFirstMove_C"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menu_O">
|
||||
<property name="title">
|
||||
|
@ -1205,6 +1206,20 @@
|
|||
<string>引擎对战(&F)</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAutoChangeFirstMove_C">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>先后手轮替(&C)</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<customwidgets>
|
||||
|
|
|
@ -31,6 +31,16 @@ bool Options::getAutoRestart()
|
|||
return isAutoRestart;
|
||||
}
|
||||
|
||||
void Options::setAutoChangeFirstMove(bool enabled)
|
||||
{
|
||||
isAutoChangeFirstMove = enabled;
|
||||
}
|
||||
|
||||
bool Options::getAutoChangeFirstMove()
|
||||
{
|
||||
return isAutoChangeFirstMove;
|
||||
}
|
||||
|
||||
void Options::setGiveUpIfMostLose(bool enabled)
|
||||
{
|
||||
giveUpIfMostLose = enabled;
|
||||
|
|
|
@ -28,6 +28,9 @@ public:
|
|||
void setAutoRestart(bool enabled);
|
||||
bool getAutoRestart();
|
||||
|
||||
void setAutoChangeFirstMove(bool enabled);
|
||||
bool getAutoChangeFirstMove();
|
||||
|
||||
void setGiveUpIfMostLose(bool enabled);
|
||||
bool getGiveUpIfMostLose();
|
||||
|
||||
|
@ -42,6 +45,9 @@ private:
|
|||
// 是否棋局结束后自动重新开局
|
||||
bool isAutoRestart { false };
|
||||
|
||||
// 是否重新开局时自动改变先后手
|
||||
bool isAutoChangeFirstMove { false };
|
||||
|
||||
// 是否必败时认输
|
||||
bool giveUpIfMostLose { false };
|
||||
|
||||
|
|
|
@ -411,6 +411,11 @@ void GameController::setAutoRestart(bool enabled)
|
|||
gameOptions.setAutoRestart(enabled);
|
||||
}
|
||||
|
||||
void GameController::setAutoChangeFirstMove(bool enabled)
|
||||
{
|
||||
gameOptions.setAutoChangeFirstMove(enabled);
|
||||
}
|
||||
|
||||
void GameController::setRandomMove(bool enabled)
|
||||
{
|
||||
gameOptions.setRandomMoveEnabled(enabled);
|
||||
|
|
|
@ -166,6 +166,9 @@ public slots:
|
|||
// 是否自动开局
|
||||
void setAutoRestart(bool enabled = false);
|
||||
|
||||
// 是否开局自动改变先后手
|
||||
void setAutoChangeFirstMove(bool enabled = false);
|
||||
|
||||
// AI 是否随机走子
|
||||
void setRandomMove(bool enabled);
|
||||
|
||||
|
@ -367,6 +370,12 @@ private:
|
|||
// 是否必败时认输
|
||||
bool giveUpIfMostLose_ {false};
|
||||
|
||||
// 是否自动交换先后手
|
||||
bool isAutoChangeFirstMove { false };
|
||||
|
||||
// AI 是否为先手
|
||||
bool isAiFirstMove { false };
|
||||
|
||||
// 定时器ID
|
||||
int timeID;
|
||||
|
||||
|
|
|
@ -204,8 +204,7 @@ void MillGameWindow::initialize()
|
|||
connect(ui.actionEngine2_R, SIGNAL(toggled(bool)),
|
||||
gameController, SLOT(setEngine2(bool)));
|
||||
|
||||
connect(ui.
|
||||
actionSound_S, SIGNAL(toggled(bool)),
|
||||
connect(ui.actionSound_S, SIGNAL(toggled(bool)),
|
||||
gameController, SLOT(setSound(bool)));
|
||||
|
||||
connect(ui.actionAnimation_A, SIGNAL(toggled(bool)),
|
||||
|
@ -217,6 +216,9 @@ void MillGameWindow::initialize()
|
|||
connect(ui.actionAutoRestart_A, SIGNAL(toggled(bool)),
|
||||
gameController, SLOT(setAutoRestart(bool)));
|
||||
|
||||
connect(ui.actionAutoChangeFirstMove_C, SIGNAL(toggled(bool)),
|
||||
gameController, SLOT(setAutoChangeFirstMove(bool)));
|
||||
|
||||
connect(ui.actionRandomMove_R, SIGNAL(toggled(bool)),
|
||||
gameController, SLOT(setRandomMove(bool)));
|
||||
|
||||
|
|
Loading…
Reference in New Issue