Commit 78772f2d authored by mercury233's avatar mercury233 Committed by GitHub

add disable chat (#2107)

parent a3c68478
...@@ -479,7 +479,8 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -479,7 +479,8 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
else if(mainGame->wSinglePlay->isVisible()) else if(mainGame->wSinglePlay->isVisible())
mainGame->HideElement(mainGame->wSinglePlay); mainGame->HideElement(mainGame->wSinglePlay);
mainGame->ShowElement(mainGame->wHostPrepare); mainGame->ShowElement(mainGame->wHostPrepare);
mainGame->wChat->setVisible(true); if(!mainGame->chkIgnore1->isChecked())
mainGame->wChat->setVisible(true);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
mainGame->dInfo.duel_rule = pkt->info.duel_rule; mainGame->dInfo.duel_rule = pkt->info.duel_rule;
watching = 0; watching = 0;
...@@ -588,7 +589,8 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -588,7 +589,8 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame->btnM2->setVisible(false); mainGame->btnM2->setVisible(false);
mainGame->btnEP->setVisible(false); mainGame->btnEP->setVisible(false);
mainGame->btnShuffle->setVisible(false); mainGame->btnShuffle->setVisible(false);
mainGame->wChat->setVisible(true); if(!mainGame->chkIgnore1->isChecked())
mainGame->wChat->setVisible(true);
mainGame->device->setEventReceiver(&mainGame->dField); mainGame->device->setEventReceiver(&mainGame->dField);
if(!mainGame->dInfo.isTag) { if(!mainGame->dInfo.isTag) {
if(selftype > 1) { if(selftype > 1) {
......
...@@ -1785,6 +1785,14 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) { ...@@ -1785,6 +1785,14 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
return true; return true;
break; break;
} }
case CHECKBOX_DISABLE_CHAT: {
bool show = mainGame->is_building ? false : !mainGame->chkIgnore1->isChecked();
mainGame->wChat->setVisible(show);
if(!show)
mainGame->ClearChatMsg();
return true;
break;
}
} }
break; break;
} }
......
...@@ -266,7 +266,7 @@ bool Game::Initialize() { ...@@ -266,7 +266,7 @@ bool Game::Initialize() {
//system //system
irr::gui::IGUITab* tabSystem = wInfos->addTab(dataManager.GetSysString(1273)); irr::gui::IGUITab* tabSystem = wInfos->addTab(dataManager.GetSysString(1273));
posY = 20; posY = 20;
chkIgnore1 = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260, posY + 25), tabSystem, -1, dataManager.GetSysString(1290)); chkIgnore1 = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260, posY + 25), tabSystem, CHECKBOX_DISABLE_CHAT, dataManager.GetSysString(1290));
chkIgnore1->setChecked(gameConf.chkIgnore1 != 0); chkIgnore1->setChecked(gameConf.chkIgnore1 != 0);
posY += 30; posY += 30;
chkIgnore2 = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260, posY + 25), tabSystem, -1, dataManager.GetSysString(1291)); chkIgnore2 = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260, posY + 25), tabSystem, -1, dataManager.GetSysString(1291));
...@@ -1320,6 +1320,11 @@ void Game::AddChatMsg(wchar_t* msg, int player) { ...@@ -1320,6 +1320,11 @@ void Game::AddChatMsg(wchar_t* msg, int player) {
} }
chatMsg[0].append(msg); chatMsg[0].append(msg);
} }
void Game::ClearChatMsg() {
for(int i = 7; i >= 0; --i) {
chatTiming[i] = 0;
}
}
void Game::AddDebugMsg(char* msg) void Game::AddDebugMsg(char* msg)
{ {
if (enable_log & 0x1) { if (enable_log & 0x1) {
......
...@@ -131,6 +131,7 @@ public: ...@@ -131,6 +131,7 @@ public:
void SaveConfig(); void SaveConfig();
void ShowCardInfo(int code); void ShowCardInfo(int code);
void AddChatMsg(wchar_t* msg, int player); void AddChatMsg(wchar_t* msg, int player);
void ClearChatMsg();
void AddDebugMsg(char* msgbuf); void AddDebugMsg(char* msgbuf);
void ClearTextures(); void ClearTextures();
void CloseDuelWindow(); void CloseDuelWindow();
...@@ -613,6 +614,7 @@ extern Game* mainGame; ...@@ -613,6 +614,7 @@ extern Game* mainGame;
#define CHECKBOX_ENABLE_SOUND 361 #define CHECKBOX_ENABLE_SOUND 361
#define CHECKBOX_ENABLE_MUSIC 362 #define CHECKBOX_ENABLE_MUSIC 362
#define SCROLL_VOLUME 363 #define SCROLL_VOLUME 363
#define CHECKBOX_DISABLE_CHAT 364
#define COMBOBOX_SORTTYPE 370 #define COMBOBOX_SORTTYPE 370
#define COMBOBOX_LIMIT 371 #define COMBOBOX_LIMIT 371
......
...@@ -305,7 +305,7 @@ ...@@ -305,7 +305,7 @@
!system 1279 开启音效 !system 1279 开启音效
!system 1280 开启音乐 !system 1280 开启音乐
!system 1281 按场景切换音乐 !system 1281 按场景切换音乐
!system 1290 忽略对方发言 !system 1290 禁用聊天功能
!system 1291 忽略观战者发言 !system 1291 忽略观战者发言
!system 1292 忽略时点 !system 1292 忽略时点
!system 1293 显示时点 !system 1293 显示时点
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment