correct click sound for a bunch of menu buttons

This commit is contained in:
Mark Vejvoda 2013-05-26 02:44:36 +00:00
parent 385bc30e7e
commit c932965d9e
6 changed files with 36 additions and 86 deletions

View File

@ -1084,16 +1084,6 @@ void MenuStateConnectedGame::simpleTask(BaseThread *callingThread) {
}
string result=refreshTilesetModInfo(tilesetListRemote[i]);
// if(result != "") {
// ModInfo modinfo;
// modinfo=tilesetCacheList[result];
// GraphicButton *button=new GraphicButton();
// button->init(tilesetInfoXPos, keyButtonsYBase, keyButtonsWidth,keyButtonsHeight);
// button->setText(modinfo.name);
// button->setUseCustomTexture(true);
// button->setCustomTexture(CoreData::getInstance().getCustomTexture());
// keyTilesetButtons.push_back(button);
// }
}
if(callingThread->getQuitStatus() == true || safeMutexThreadOwner.isValidMutex() == false) {
@ -1127,22 +1117,6 @@ void MenuStateConnectedGame::simpleTask(BaseThread *callingThread) {
}
string result=refreshTechModInfo(techListRemote[i]);
// if(result != "") {
// ModInfo modinfo;
// modinfo=techCacheList[result];
//
// GraphicButton *button=new GraphicButton();
// button->init(techInfoXPos, keyButtonsYBase, keyButtonsWidth,keyButtonsHeight);
// button->setText(modinfo.name);
// button->setUseCustomTexture(true);
// button->setCustomTexture(CoreData::getInstance().getCustomTexture());
//
// keyTechButtons.push_back(button);
// GraphicLabel *label=new GraphicLabel();
// label->init(techInfoXPos + keyButtonsWidth+10,keyButtonsYBase,labelWidth,20);
// label->setText(modinfo.count);
// labelsTech.push_back(label);
// }
}
if(callingThread->getQuitStatus() == true || safeMutexThreadOwner.isValidMutex() == false) {
@ -1171,22 +1145,6 @@ void MenuStateConnectedGame::simpleTask(BaseThread *callingThread) {
}
string result=refreshMapModInfo(mapListRemote[i]);
// if(result != "") {
// ModInfo modinfo;
// modinfo=mapCacheList[result];
//
// GraphicButton *button=new GraphicButton();
// button->init(mapInfoXPos, keyButtonsYBase, keyButtonsWidth,keyButtonsHeight);
// button->setText(modinfo.name);
// button->setUseCustomTexture(true);
// button->setCustomTexture(CoreData::getInstance().getCustomTexture());
// keyMapButtons.push_back(button);
//
// GraphicLabel *label=new GraphicLabel();
// label->init(mapInfoXPos + keyButtonsWidth + 10,keyButtonsYBase,labelWidth,20);
// label->setText(modinfo.count);
// labelsMap.push_back(label);
// }
}
if(callingThread->getQuitStatus() == true || safeMutexThreadOwner.isValidMutex() == false) {
@ -1354,6 +1312,8 @@ void MenuStateConnectedGame::mouseClick(int x, int y, MouseButton mouseButton){
}
}
else if(buttonCancelDownloads.mouseClick(x,y)) {
soundRenderer.playFx(coreData.getClickSoundA());
if(ftpClientThread != NULL && fileFTPProgressList.empty() == false) {
ftpClientThread->setCallBackObject(NULL);
@ -1477,28 +1437,6 @@ void MenuStateConnectedGame::mouseClick(int x, int y, MouseButton mouseButton){
else if(buttonDisconnect.mouseClick(x,y)){
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
/*
soundRenderer.playFx(coreData.getClickSoundA());
if(clientInterface->getSocket() != NULL) {
if(clientInterface->isConnected() == true) {
Lang &lang= Lang::getInstance();
const vector<string> languageList = clientInterface->getGameSettings()->getUniqueNetworkPlayerLanguages();
for(unsigned int i = 0; i < languageList.size(); ++i) {
string sQuitText = lang.get("QuitGame",languageList[i]);
clientInterface->sendTextMessage(sQuitText,-1,false,languageList[i]);
//printf("~~~ langList[%s] localLang[%s] msg[%s]\n",languageList[i].c_str(),lang.getLanguage().c_str(), sQuitText.c_str());
}
sleep(1);
}
clientInterface->close();
}
clientInterface->reset();
networkManager.end();
currentFactionName="";
currentMap="";
returnToJoinMenu();
*/
disconnectFromServer();
networkManager.end();
returnToJoinMenu();
@ -1585,7 +1523,7 @@ void MenuStateConnectedGame::mouseClick(int x, int y, MouseButton mouseButton){
if(i < mapInfo.players && grabSlotButton[i].mouseClick(x, y)) {
//printf("Send slot switch request for slot = %d, myCurrentIndex = %d\n",i,myCurrentIndex);
soundRenderer.playFx(coreData.getClickSoundA());
soundRenderer.playFx(coreData.getClickSoundB());
clientInterface->setGameSettingsReceived(false);
settingsReceivedFromServer= false;
@ -1776,7 +1714,12 @@ void MenuStateConnectedGame::mouseClickAdmin(int x, int y, MouseButton mouseButt
}
else if(buttonRestoreLastSettings.mouseClick(x,y) && buttonRestoreLastSettings.getEnabled()) {
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
RestoreLastGameSettings();
CoreData &coreData= CoreData::getInstance();
SoundRenderer &soundRenderer= SoundRenderer::getInstance();
soundRenderer.playFx(coreData.getClickSoundB());
RestoreLastGameSettings();
}
else if(listBoxMap.mouseClick(x, y,advanceToItemStartingWith)) {
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);

View File

@ -1046,11 +1046,9 @@ void MenuStateCustomGame::mouseClick(int x, int y, MouseButton mouseButton) {
if(mainMessageBox.getEnabled()){
int button= 0;
if(mainMessageBox.mouseClick(x, y, button))
{
if(mainMessageBox.mouseClick(x, y, button)) {
soundRenderer.playFx(coreData.getClickSoundA());
if(button==0)
{
if(button == 0) {
mainMessageBox.setEnabled(false);
}
}
@ -1089,6 +1087,8 @@ void MenuStateCustomGame::mouseClick(int x, int y, MouseButton mouseButton) {
return;
}
else if(buttonRestoreLastSettings.mouseClick(x,y) && buttonRestoreLastSettings.getEnabled()) {
soundRenderer.playFx(coreData.getClickSoundB());
RestoreLastGameSettings();
}
else if(listBoxMap.mouseClick(x, y,advanceToItemStartingWith)){
@ -1368,6 +1368,8 @@ void MenuStateCustomGame::mouseClick(int x, int y, MouseButton mouseButton) {
}
}
else if(buttonClearBlockedPlayers.mouseClick(x, y)) {
soundRenderer.playFx(coreData.getClickSoundB());
ServerInterface* serverInterface= NetworkManager::getInstance().getServerInterface();
if(serverInterface != NULL) {
ServerSocket *serverSocket = serverInterface->getServerSocket();
@ -1377,6 +1379,8 @@ void MenuStateCustomGame::mouseClick(int x, int y, MouseButton mouseButton) {
}
}
else if(buttonBlockPlayers[i].mouseClick(x, y)) {
soundRenderer.playFx(coreData.getClickSoundB());
ServerInterface* serverInterface= NetworkManager::getInstance().getServerInterface();
if(serverInterface != NULL) {
if(serverInterface->getSlot(i) != NULL &&

View File

@ -368,7 +368,7 @@ void MenuStateJoinGame::mouseClick(int x, int y, MouseButton mouseButton) {
else if(buttonConnect.mouseClick(x, y) && buttonConnect.getEnabled() == true) {
ClientInterface* clientInterface= networkManager.getClientInterface();
soundRenderer.playFx(coreData.getClickSoundA());
soundRenderer.playFx(coreData.getClickSoundB());
labelInfo.setText("");
if(clientInterface->isConnected())
@ -383,6 +383,7 @@ void MenuStateJoinGame::mouseClick(int x, int y, MouseButton mouseButton) {
else if(buttonCreateGame.mouseClick(x, y)){
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
soundRenderer.playFx(coreData.getClickSoundB());
clientInterface->stopServerDiscovery();
if(clientInterface->getSocket() != NULL) {
clientInterface->close();
@ -396,7 +397,7 @@ void MenuStateJoinGame::mouseClick(int x, int y, MouseButton mouseButton) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
ClientInterface* clientInterface= networkManager.getClientInterface();
soundRenderer.playFx(coreData.getClickSoundA());
soundRenderer.playFx(coreData.getClickSoundB());
// Triggers a thread which calls back into MenuStateJoinGame::DiscoveredServers
// with the results

View File

@ -198,6 +198,7 @@ void MenuStateLoadGame::mouseClick(int x, int y, MouseButton mouseButton){
SoundRenderer &soundRenderer= SoundRenderer::getInstance();
if(mainMessageBox.getEnabled()) {
soundRenderer.playFx(coreData.getClickSoundA());
int button= 0;
if(mainMessageBox.mouseClick(x, y, button)) {
mainMessageBox.setEnabled(false);
@ -207,7 +208,7 @@ void MenuStateLoadGame::mouseClick(int x, int y, MouseButton mouseButton){
}
}
if(abortButton.mouseClick(x, y)) {
soundRenderer.playFx(coreData.getClickSoundB());
soundRenderer.playFx(coreData.getClickSoundA());
mainMenu->setState(new MenuStateRoot(program, mainMenu));
}
else if(deleteButton.mouseClick(x, y)) {
@ -271,12 +272,14 @@ void MenuStateLoadGame::mouseClick(int x, int y, MouseButton mouseButton){
//mainMenu->setState(new MenuStateRoot(program, mainMenu));
}
else if(slotsScrollBar.mouseClick(x, y)){
soundRenderer.playFx(coreData.getClickSoundB());
soundRenderer.playFx(coreData.getClickSoundA());
}
else {
if(slotsScrollBar.getElementCount()!=0){
for(int i = slotsScrollBar.getVisibleStart(); i <= slotsScrollBar.getVisibleEnd(); ++i) {
if(slots[i]->mouseClick(x, y) && selectedButton != slots[i]) {
soundRenderer.playFx(coreData.getClickSoundB());
needsToBeFreedTexture = previewTexture;
selectedButton = slots[i];
string filename = saveGameDir + selectedButton->getText()+".xml";

View File

@ -508,23 +508,21 @@ void MenuStateMasterserver::mouseClick(int x, int y, MouseButton mouseButton){
if(mainMessageBox.getEnabled()){
int button= 0;
if(mainMessageBox.mouseClick(x, y, button))
{
if(mainMessageBox.mouseClick(x, y, button)) {
soundRenderer.playFx(coreData.getClickSoundA());
if(button==0)
{
if(button == 0) {
mainMessageBox.setEnabled(false);
}
}
}
else if(userScrollBar.mouseClick(x, y)){
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
soundRenderer.playFx(coreData.getClickSoundB());
soundRenderer.playFx(coreData.getClickSoundA());
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
}
else if(serverScrollBar.mouseClick(x, y)){
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
soundRenderer.playFx(coreData.getClickSoundB());
soundRenderer.playFx(coreData.getClickSoundA());
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
}
else if(buttonRefresh.mouseClick(x, y)){
@ -539,7 +537,7 @@ void MenuStateMasterserver::mouseClick(int x, int y, MouseButton mouseButton){
else if(buttonReturn.mouseClick(x, y)){
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
soundRenderer.playFx(coreData.getClickSoundB());
soundRenderer.playFx(coreData.getClickSoundA());
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
if (ircClient != NULL && ircClient->isConnected() == true
@ -596,6 +594,8 @@ void MenuStateMasterserver::mouseClick(int x, int y, MouseButton mouseButton){
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
safeMutex.ReleaseLock();
if(connected){
soundRenderer.playFx(coreData.getClickSoundB());
if (ircClient != NULL && ircClient->isConnected() == true
&& ircClient->getHasJoinedChannel() == true) {
ircClient->SendIRCCmdMessage(IRC_CHANNEL, "connecting to '"+serverLines[i]->getMasterServerInfo()->getServerTitle()+"'");

View File

@ -1502,25 +1502,24 @@ void MenuStateMods::mouseClick(int x, int y, MouseButton mouseButton) {
}
else if(keyTechScrollBar.mouseClick(x, y)) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
soundRenderer.playFx(coreData.getClickSoundB());
soundRenderer.playFx(coreData.getClickSoundA());
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
}
else if(keyTilesetScrollBar.mouseClick(x, y)) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
soundRenderer.playFx(coreData.getClickSoundB());
soundRenderer.playFx(coreData.getClickSoundA());
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
}
else if(keyMapScrollBar.mouseClick(x, y)) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
soundRenderer.playFx(coreData.getClickSoundB());
soundRenderer.playFx(coreData.getClickSoundA());
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
}
else if(keyScenarioScrollBar.mouseClick(x, y)) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
soundRenderer.playFx(coreData.getClickSoundB());
soundRenderer.playFx(coreData.getClickSoundA());
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
}
else if(buttonInstallTech.mouseClick(x, y) && buttonInstallTech.getEnabled()) {
soundRenderer.playFx(coreData.getClickSoundB());
if(selectedTechName != "") {