mirror of
https://github.com/glest/glest-source.git
synced 2025-08-20 07:01:21 +02:00
- messagebox prompt for downloading maps
This commit is contained in:
@@ -85,6 +85,10 @@ MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainM
|
|||||||
mainMessageBox.setEnabled(false);
|
mainMessageBox.setEnabled(false);
|
||||||
mainMessageBoxState=0;
|
mainMessageBoxState=0;
|
||||||
|
|
||||||
|
ftpMessageBox.registerGraphicComponent(containerName,"ftpMessageBox");
|
||||||
|
ftpMessageBox.init(lang.get("Yes"),lang.get("no"));
|
||||||
|
ftpMessageBox.setEnabled(false);
|
||||||
|
|
||||||
NetworkManager &networkManager= NetworkManager::getInstance();
|
NetworkManager &networkManager= NetworkManager::getInstance();
|
||||||
Config &config = Config::getInstance();
|
Config &config = Config::getInstance();
|
||||||
defaultPlayerName = config.getString("NetPlayerName",Socket::getHostName().c_str());
|
defaultPlayerName = config.getString("NetPlayerName",Socket::getHostName().c_str());
|
||||||
@@ -420,6 +424,24 @@ void MenuStateConnectedGame::mouseClick(int x, int y, MouseButton mouseButton){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(ftpMessageBox.getEnabled()) {
|
||||||
|
int button= 1;
|
||||||
|
if(ftpMessageBox.mouseClick(x, y, button)) {
|
||||||
|
soundRenderer.playFx(coreData.getClickSoundA());
|
||||||
|
ftpMessageBox.setEnabled(false);
|
||||||
|
if(button == 1) {
|
||||||
|
getMissingMapFromFTPServerInProgress = true;
|
||||||
|
|
||||||
|
char szMsg[1024]="";
|
||||||
|
sprintf(szMsg,"Player: %s is attempting to download the map: %s",getHumanPlayerName().c_str(),getMissingMapFromFTPServer.c_str());
|
||||||
|
clientInterface->sendTextMessage(szMsg,-1, true);
|
||||||
|
|
||||||
|
if(ftpClientThread != NULL) {
|
||||||
|
ftpClientThread->addMapToRequests(getMissingMapFromFTPServer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
else if(buttonDisconnect.mouseClick(x,y)){
|
else if(buttonDisconnect.mouseClick(x,y)){
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
@@ -533,6 +555,10 @@ void MenuStateConnectedGame::mouseMove(int x, int y, const MouseState *ms){
|
|||||||
mainMessageBox.mouseMove(x, y);
|
mainMessageBox.mouseMove(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ftpMessageBox.getEnabled()) {
|
||||||
|
ftpMessageBox.mouseMove(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
buttonDisconnect.mouseMove(x, y);
|
buttonDisconnect.mouseMove(x, y);
|
||||||
buttonPlayNow.mouseMove(x, y);
|
buttonPlayNow.mouseMove(x, y);
|
||||||
|
|
||||||
@@ -568,6 +594,10 @@ void MenuStateConnectedGame::render() {
|
|||||||
renderer.renderMessageBox(&mainMessageBox);
|
renderer.renderMessageBox(&mainMessageBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(ftpMessageBox.getEnabled()){
|
||||||
|
renderer.renderMessageBox(&ftpMessageBox);
|
||||||
|
}
|
||||||
|
|
||||||
if (!initialSettingsReceivedFromServer) return;
|
if (!initialSettingsReceivedFromServer) return;
|
||||||
|
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
@@ -967,9 +997,10 @@ void MenuStateConnectedGame::update() {
|
|||||||
else {
|
else {
|
||||||
// try to get the map via ftp
|
// try to get the map via ftp
|
||||||
if(ftpClientThread != NULL && getMissingMapFromFTPServer != currentMap) {
|
if(ftpClientThread != NULL && getMissingMapFromFTPServer != currentMap) {
|
||||||
getMissingMapFromFTPServer = currentMap;
|
if(ftpMessageBox.getEnabled() == false) {
|
||||||
getMissingMapFromFTPServerInProgress = true;
|
getMissingMapFromFTPServer = currentMap;
|
||||||
ftpClientThread->addMapToRequests(currentMap);
|
showFTPMessageBox("Download missing map: " + currentMap + " ?", "Question", false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
maps.push_back("***missing***");
|
maps.push_back("***missing***");
|
||||||
}
|
}
|
||||||
@@ -1571,6 +1602,21 @@ void MenuStateConnectedGame::showMessageBox(const string &text, const string &he
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MenuStateConnectedGame::showFTPMessageBox(const string &text, const string &header, bool toggle) {
|
||||||
|
if(!toggle) {
|
||||||
|
ftpMessageBox.setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!ftpMessageBox.getEnabled()) {
|
||||||
|
ftpMessageBox.setText(text);
|
||||||
|
ftpMessageBox.setHeader(header);
|
||||||
|
ftpMessageBox.setEnabled(true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ftpMessageBox.setEnabled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MenuStateConnectedGame::FTPClient_CallbackEvent(string mapFilename, FTP_Client_ResultType result) {
|
void MenuStateConnectedGame::FTPClient_CallbackEvent(string mapFilename, FTP_Client_ResultType result) {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
|
@@ -136,6 +136,7 @@ private:
|
|||||||
|
|
||||||
std::vector<std::string> tileSets;
|
std::vector<std::string> tileSets;
|
||||||
|
|
||||||
|
GraphicMessageBox ftpMessageBox;
|
||||||
FTPClientThread *ftpClientThread;
|
FTPClientThread *ftpClientThread;
|
||||||
string getMissingMapFromFTPServer;
|
string getMissingMapFromFTPServer;
|
||||||
bool getMissingMapFromFTPServerInProgress;
|
bool getMissingMapFromFTPServerInProgress;
|
||||||
@@ -169,6 +170,7 @@ private:
|
|||||||
bool loadMapInfo(string file, MapInfo *mapInfo, bool loadMapPreview);
|
bool loadMapInfo(string file, MapInfo *mapInfo, bool loadMapPreview);
|
||||||
void showMessageBox(const string &text, const string &header, bool toggle);
|
void showMessageBox(const string &text, const string &header, bool toggle);
|
||||||
|
|
||||||
|
void showFTPMessageBox(const string &text, const string &header, bool toggle);
|
||||||
virtual void FTPClient_CallbackEvent(string mapFilename, FTP_Client_ResultType result);
|
virtual void FTPClient_CallbackEvent(string mapFilename, FTP_Client_ResultType result);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user